Class NavigationService
- Namespace
- Icy.Navigation
- Assembly
- IcyUI.dll
The default INavigationService - every Frame owns exactly one, created for it in its constructor.
public sealed class NavigationService : INavigationService
- Inheritance
-
NavigationService
- Implements
- Inherited Members
- Extension Methods
Remarks
Navigate(string) resolves path against the owning Frame's configuration
(DefaultAssetContext), the same asset pipeline any other
.xml markup file loads through - see MarkupImporter. IsAvailable(string?)
is what makes a missing page return null instead of throwing: everything else the loader
can fail on (malformed markup, a root that isn't a Page) is a genuine error, not a "not found".
Back/forward history is two stacks of Page instances. Navigating away from a page only pushes it onto the relevant stack when KeepAlive is set - see its remarks for why. A fresh forward-navigation (Navigate(string) or NavigateTo(Page)) always clears the forward history, the same way a browser discards forward history once you navigate somewhere new instead of following "next" again.
Constructors
NavigationService(Frame)
The default INavigationService - every Frame owns exactly one, created for it in its constructor.
public NavigationService(Frame frame)
Parameters
frameFrameThe frame this service navigates.
Remarks
Navigate(string) resolves path against the owning Frame's configuration
(DefaultAssetContext), the same asset pipeline any other
.xml markup file loads through - see MarkupImporter. IsAvailable(string?)
is what makes a missing page return null instead of throwing: everything else the loader
can fail on (malformed markup, a root that isn't a Page) is a genuine error, not a "not found".
Back/forward history is two stacks of Page instances. Navigating away from a page only pushes it onto the relevant stack when KeepAlive is set - see its remarks for why. A fresh forward-navigation (Navigate(string) or NavigateTo(Page)) always clears the forward history, the same way a browser discards forward history once you navigate somewhere new instead of following "next" again.
Properties
CurrentPage
public Page? CurrentPage { get; }
Property Value
Methods
Clear()
Clears the back/forward history and the frame's current content.
public void Clear()
Navigate(string)
Loads the page at path through the asset pipeline and navigates to it.
public Page? Navigate(string path)
Parameters
Returns
NavigateTo(Page)
Navigates to an already-constructed page instance.
public Page NavigateTo(Page page)
Parameters
pagePageThe page to navigate to.
Returns
- Page
page, or the frame's unchanged CurrentPage if a Navigating handler canceled the navigation.
TryNavigateBack()
Navigates to the previous page in the back history, if any.
public Page? TryNavigateBack()
Returns
TryNavigateNext()
Navigates to the next page in the forward history, if any.
public Page? TryNavigateNext()
Returns
Events
Navigating
Occurs before a navigation takes effect. Setting Cancel leaves the frame showing whatever it already was.
public event EventHandler<NavigationEventArgs>? Navigating