Frame.SetNavigationState Method

Definition

Overloads

SetNavigationState(String)

Reads and restores the navigation history of a Frame from a provided serialization string.

SetNavigationState(String, Boolean)

Reads and restores the navigation history of a Frame from a provided serialization string.

SetNavigationState(String)

Reads and restores the navigation history of a Frame from a provided serialization string.

public:
 virtual void SetNavigationState(Platform::String ^ navigationState) = SetNavigationState;
/// [Windows.Foundation.Metadata.Overload("SetNavigationState")]
void SetNavigationState(winrt::hstring const& navigationState);
[Windows.Foundation.Metadata.Overload("SetNavigationState")]
public void SetNavigationState(string navigationState);
Public Sub SetNavigationState (navigationState As String)

Parameters

navigationState
String

The serialization string that supplies the restore point for navigation history.

Attributes
Windows.Foundation.Metadata.OverloadAttribute

Remarks

This method is useful to restore the navigation state of your app after it has been suspended and resumed. When your app is suspended, call GetNavigationState and save the return value. When your app is resumed, call SetNavigationState and pass it the saved value.

Calling SetNavigationState will call Page.OnNavigatedTo for the current page, with NavigationMode.Back. SetNavigationState is usually called when the application is being resumed, so the current page is navigated to.

Applies to

SetNavigationState(String, Boolean)

Reads and restores the navigation history of a Frame from a provided serialization string.

public:
 virtual void SetNavigationState(Platform::String ^ navigationState, bool suppressNavigate) = SetNavigationState;
/// [Windows.Foundation.Metadata.Overload("SetNavigationStateWithNavigationControl")]
void SetNavigationState(winrt::hstring const& navigationState, bool const& suppressNavigate);
[Windows.Foundation.Metadata.Overload("SetNavigationStateWithNavigationControl")]
public void SetNavigationState(string navigationState, bool suppressNavigate);
Public Sub SetNavigationState (navigationState As String, suppressNavigate As Boolean)

Parameters

navigationState
String

The serialization string that supplies the restore point for navigation history.

suppressNavigate
Boolean

true to restore navigation history without navigating to the current page; otherwise, false.

Attributes
Windows.Foundation.Metadata.OverloadAttribute

Remarks

If you call SetNavigationState with the suppressNavigate parameter set to true, Page.OnNavigatedTo is not called for the current page. The current page is also put into the BackStack. When suppressing the transition, also be sure to use GoBack or GoForward to navigate to the correct page in the navigation history. NavigateTo is also supported, however the forward stack will be cleared when it is used.

Applies to