Class Page
Encapsulates content that can be navigated to by a Frame.
Inherited Members
Namespace: System.Windows.Controls
Assembly: Controls.Navigation.OpenSilver.dll
Syntax
public class Page : UserControl
Constructors
| Improve this Doc View SourcePage()
Initializes a new instance of the Page class.
Declaration
public Page()
Properties
| Improve this Doc View SourceNavigationCacheMode
Gets or sets a value indicating whether this page should never be cached, should be cached for an indefinite length of time, or should only be cached within the size limitations of the cache.
Declaration
public NavigationCacheMode NavigationCacheMode { get; set; }
Property Value
Type | Description |
---|---|
NavigationCacheMode |
NavigationContext
Gets an object that contains information about the navigation request.
Declaration
public NavigationContext NavigationContext { get; }
Property Value
Type | Description |
---|---|
NavigationContext |
NavigationService
Gets the service that the host used to navigate to this page.
Declaration
public NavigationService NavigationService { get; }
Property Value
Type | Description |
---|---|
NavigationService |
Title
Gets or sets the name for the page to display to the user in the navigation history.
Declaration
public string Title { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Methods
| Improve this Doc View SourceOnFragmentNavigation(FragmentNavigationEventArgs)
This method is called when fragment navigation occurs on a page - either because a fragment was present in the original Uri that navigated to this page, or because a later fragment navigation occurs.
Declaration
protected virtual void OnFragmentNavigation(FragmentNavigationEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
FragmentNavigationEventArgs | e | The event arguments, containing the fragment navigated to |
Remarks
This should be used rather than signing up for NavigationService.FragmentNavigation because that event may be difficult to sign up for in time to get the first fragment navigation.
OnNavigatedFrom(NavigationEventArgs)
This method is called when a Page has been navigated away from, and is no longer the active Page in a Frame. This is a good time to save dirty data or otherwise react to being inactive.
Declaration
protected virtual void OnNavigatedFrom(NavigationEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
NavigationEventArgs | e | The event arguments |
Remarks
This is similar to signing up for NavigationService.Navigated, but this method is preferred as then you do not need to remove the event handler from NavigationService to avoid object lifetime issues.
OnNavigatedTo(NavigationEventArgs)
This method is called when a Page has been navigated to, and becomes the active Page in a Frame. This method is the preferred place to inspect NavigationContext, and react to load-time information and prepare the page for viewing.
Declaration
protected virtual void OnNavigatedTo(NavigationEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
NavigationEventArgs | e | The event arguments |
Remarks
This should be used rather than Loaded because Loaded signifies you have been added to the visual tree, but that could potentially happen more than once during a logical navigation event, in some advanced scenarios. This method is guaranteed to be called only once when the Page becomes active.
OnNavigatingFrom(NavigatingCancelEventArgs)
This method is called when a Page is about to be navigated away from.
Declaration
protected virtual void OnNavigatingFrom(NavigatingCancelEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
NavigatingCancelEventArgs | e | The event arguments. If Cancel is set to true, it will cancel the pending operation that triggered this method call. |
Remarks
This is similar to signing up for NavigationService.Navigating, but this method is preferred as then you do not need to remove the event handler from NavigationService to avoid object lifetime issues.