Method UpdateCurrentRoute
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.
Declaration
void UpdateCurrentRoute(string? anchor)
Parameters
| Type | Name | Description |
|---|---|---|
| string | anchor | The new anchor to set on the current route, or null to clear the anchor. |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | The navigator does not have a current route or a navigation is currently in progress. |
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.
Declaration
void UpdateCurrentRoute(IConcreteRoutePart concreteRoutePart, string? anchor = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IConcreteRoutePart | concreteRoutePart | The new concrete route part to replace the last route part of the current route. |
| string | anchor | The new anchor to set on the current route, or null to clear the anchor. |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | The navigator does not have a current route or a navigation is currently in progress. |
| ArgumentException | The view model type of the specified route part does not match the last route part of the current route. |