Class Navigator
Represents a navigator that can navigate a hierarchy of views using routes and display dialogs for an application or window.
Inherited Members
Namespace: Singulink.UI.Navigation.WinUI
Assembly: Singulink.UI.Navigation.WinUI.dll
Syntax
public sealed class Navigator : NavigatorCore, INavigator, INotifyPropertyChanged, IDialogPresenter
Remarks
Navigator instances are not thread-safe and should only be accessed from the UI thread. Attempting to access methods or properties from a non-UI thread will result in an InvalidOperationException being thrown. Any exceptions to this rule are documented in method or property summaries.
Constructors
| Name | Description |
|---|---|
| Navigator(ContentControl, Action<NavigatorBuilder>) | Initializes a new instance of the Navigator class with the specified content control for displaying the active view and navigator build action. |
| Navigator(ViewNavigator, Action<NavigatorBuilder>) | Initializes a new instance of the Navigator class with the specified root view navigator and navigator build action. |
Methods
| Name | Description |
|---|---|
| CloseLightDismissPopups() | Closes any light-dismiss popups that are currently open. |
| EnsureThreadAccess() | Ensures that the current call is happening on the required thread. |
| HideDialog(object) | Hides the specified framework dialog object. |
| HookSystemNavigationRequests() | Configures the navigator to handle system back/forward navigation requests on supported platforms. |
| HookWindowActivatedEvent(Window, Func<Navigator, Task>, Func<Navigator, NavigationRouteException, Task>?) | Configures the navigator to handle the first window activation by triggering an initial navigation action. Must be called before the window is activated for the initial navigation to work. |
| HookWindowClosedEvents(Window) | Configures the navigator to handle window closed events to trigger navigator shutdown and prevent closing the window if navigation or busy task are in progress, dialogs are showing, or any view models are preventing navigating away from the current view. |
| SetActiveView(object, object?) | Sets the active view in the specified view navigator. |
| StartShowingDialog(object) | Starts showing the specified framework dialog object. This is invoked in a fire-and-forget manner; awaiting completion of the dialog is handled by the core orchestration via the dialog's TaskCompletionSource. |
| WireDialog(object, IDialogViewModel, out ITaskRunner) | Wires up a newly created framework-specific dialog object with the specified view model. The implementation should attach the view model as the dialog's data context, hook up any framework-specific bindings/event handlers, and produce a task runner used to run dialog operations. |
| WireView(object, IRoutedViewModelBase, out object?) | Wires up a newly materialized view with the specified view model. The implementation should attach the view model as the view's data context, hook up any framework-specific bindings/event handlers, and produce the child view navigator if the view is a parent view. |