Interface INavigator
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
Assembly: Singulink.UI.Navigation.dll
Syntax
public interface INavigator : IDialogPresenter, INotifyPropertyChanged
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.
Properties
| Name | Description |
|---|---|
| CanGoBack | Gets a value indicating whether the navigator can navigate back to the previous view. This property can be used to bind the enabled state of a back button in the UI and should be checked before calling GoBackAsync(). |
| CanGoForward | Gets a value indicating whether the navigator can navigate forward to the next view. This property can be used to bind the enabled state of a forward button in the UI and should be checked before calling GoForwardAsync(). |
| CanRefresh | Gets a value indicating whether the navigator can refresh the current view. This property can be used to bind the enabled state of a refresh button or "pull to refresh" feature in the UI and should be checked before calling RefreshAsync(). |
| CurrentRoute | Gets information about the current route, including the path and options. |
| HasBackHistory | Gets a value indicating whether the navigator has back history. |
| HasForwardHistory | Gets a value indicating whether the navigator has forward history. |
| IsNavigating | Gets a value indicating whether the navigator is currently in the process of navigating to a new view. |
| IsShowingDialog | Gets a value indicating whether the navigator is currently showing a dialog. |
Methods
| Name | Description |
|---|---|
| ClearHistoryAsync() | Clears back and forward navigation history. |
| CurrentPathStartsWith(ConcreteRoute) | Determines whether the current route path starts with the same path as the specified route. |
| CurrentPathStartsWith(IConcreteRootRoutePart) | Determines whether the current route path starts with the same path as the specified root route part. |
| CurrentRouteHasParent<TViewModel>() | Determines whether the current route contains a parent view with the specified view model type. |
| GetBackStack() | Returns the routes that are in the back navigation stack, ordered from the most recent to the oldest. Does not include the current route. |
| GetCurrentRoutePartsToParent(Type) | Gets the current route parts up to the specified parent view model type. |
| GetForwardStack() | Returns a list of routes currently in the forward navigation stack. Does not include the current route. |
| GoBackAsync() | Navigates back to the previous view. |
| GoForwardAsync() | Navigates forward to the next view. |
| NavigateAsync(ConcreteRoute, string?) | Navigates to the specified route. |
| NavigateAsync(IConcreteRootRoutePart, string?) | Navigates to the specified root route. |
| NavigateAsync(string) | Navigates to the specified route. |
| NavigatePartialAsync(string?) | Navigates to a partial route that has the same path as the current route but with the specified options. |
| NavigatePartialAsync<TParentViewModel>(ConcretePartialRoute<TParentViewModel>, string?) | Navigates to the specified partial route beneath the parent view model type in the current route. The current route must contain a view with the specified parent view model type otherwise an InvalidOperationException is thrown. |
| NavigatePartialAsync<TParentViewModel>(IConcreteChildRoutePart<TParentViewModel>, string?) | Navigates to the specified child route beneath the parent view model type in the current route. The current route must contain a view with the specified parent view model type otherwise an InvalidOperationException is thrown. |
| NavigateToParentAsync<TParentViewModel>(string?) | Navigates to the parent view in the current route that has the specified view model type. |
| RefreshAsync() | Refreshes the current route. |
| UpdateCurrentRoute(IConcreteRoutePart, string?) | Updates the last route part of the current route in-place without triggering any navigation lifecycle events. The new route part must have a view model type that matches the last route part of the current route. This is useful when a route changes in response to an action (e.g. a form submission that creates a new entry and transitions from a "new-entry" to an "entry/{id}" route) without causing a full navigation. |
| UpdateCurrentRoute(string?) | Updates the current route in-place without triggering any navigation lifecycle events. This is useful for updating the anchor or other options in response to UI state changes (e.g. selected item in a list) without causing a full navigation. |