Interface IRouter
Represents a router that can be used to navigate to different screens.
public interface IRouter
Properties
CurrentPath
Gets an observable containing the current path.
IObservable<string?> CurrentPath { get; }
Property Value
Routes
Gets a list of router registrations, you can use this to register new routes.
List<IRouterRegistration> Routes { get; }
Property Value
Methods
ClearHistory()
Clears the navigation history.
void ClearHistory()
ClearPreviousWindowRoute()
Clears the route used by the previous window, so that it is not restored when the main window opens.
void ClearPreviousWindowRoute()
GoBack()
Asynchronously navigates back to the previous active route.
Task<bool> GoBack()
Returns
- Task<bool>
A task containing a boolean value which indicates whether there was a previous path to go back to.
GoForward()
Asynchronously navigates forward to the previous active route.
Task<bool> GoForward()
Returns
- Task<bool>
A task containing a boolean value which indicates whether there was a forward path to go back to.
GoUp(RouterNavigationOptions?)
Asynchronously navigates upwards to the parent route.
Task<bool> GoUp(RouterNavigationOptions? options = null)
Parameters
optionsRouterNavigationOptions
Returns
Navigate(string, RouterNavigationOptions?)
Asynchronously navigates to the provided path.
Task Navigate(string path, RouterNavigationOptions? options = null)
Parameters
pathstringThe path to navigate to.
optionsRouterNavigationOptionsOptional navigation options used to control navigation behaviour.
Returns
- Task
A task representing the operation
Remarks
Navigating cancels any currently processing navigations.
Reload()
Asynchronously reloads the current route
Task Reload()
Returns
- Task
A task representing the operation
SetRoot<TScreen>(RoutableHostScreen<TScreen>)
Sets the root screen from which navigation takes place.
void SetRoot<TScreen>(RoutableHostScreen<TScreen> root) where TScreen : RoutableScreen
Parameters
rootRoutableHostScreen<TScreen>The root screen to set.
Type Parameters
TScreenThe type of the root screen. It must be a class.
SetRoot<TScreen, TParam>(RoutableHostScreen<TScreen, TParam>)
Sets the root screen from which navigation takes place.
void SetRoot<TScreen, TParam>(RoutableHostScreen<TScreen, TParam> root) where TScreen : RoutableScreen where TParam : new()
Parameters
rootRoutableHostScreen<TScreen, TParam>The root screen to set.
Type Parameters
TScreenThe type of the root screen. It must be a class.
TParamThe type of the parameters for the root screen. It must have a parameterless constructor.