Class RoutePin
Keeps the views and view models of a route materialized until the pin is disposed. Created with PinCurrentRoute().
Implements
Namespace: Singulink.UI.Navigation
Assembly: Singulink.UI.Navigation.dll
Syntax
public sealed class RoutePin : IDisposable
Remarks
While a pin is active, the pinned route's leaf view and view model are retained regardless of the navigator's caching settings and regardless of whether the route remains in the navigation history, together with each ancestor up to the first one that is not pinnable (see CanBePinned). Navigating to the route again (see NavigateAsync(NavigatorRoute)) reuses the retained instances with their state intact.
Ancestors that are not pinned follow the normal caching rules. If one of them is evicted and the pinned view models depended on services it provided, the pinned view models are evicted with it and the pin stops holding anything (see IsPinned).
Disposing the pin releases the retained instances on the next navigation unless they are still cached or active by then. Pins are released automatically when the navigator shuts down. The navigator does not keep pins alive, so a pin that is dropped without being disposed is released once it has been garbage collected, but pins should always be disposed deterministically and debug builds report ones that were not.
Properties
| Name | Description |
|---|---|
| IsPinned | Gets a value indicating whether the pin is still holding the route's views and view models. Returns false once the pin has been disposed, the retained view models have been evicted along with an ancestor they depended on, or the navigator has shut down. |
| Route | Gets the pinned route. |
Methods
| Name | Description |
|---|---|
| Dispose() | Releases the pin. The route's views and view models are released on the next navigation unless they are still cached or active by then. |