Udostępnij za pośrednictwem


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;
void SetNavigationState(winrt::hstring const& navigationState);
/// [Windows.Foundation.Metadata.Overload("SetNavigationState")]
void SetNavigationState(winrt::hstring const& navigationState);
public void SetNavigationState(string navigationState);
[Windows.Foundation.Metadata.Overload("SetNavigationState")]
public void SetNavigationState(string navigationState);
function setNavigationState(navigationState)
Public Sub SetNavigationState (navigationState As String)

Parameters

navigationState
String

Platform::String

winrt::hstring

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

Attributes

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);
function setNavigationState(navigationState, suppressNavigate)
Public Sub SetNavigationState (navigationState As String, suppressNavigate As Boolean)

Parameters

navigationState
String

Platform::String

winrt::hstring

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

suppressNavigate
Boolean

bool

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

Attributes

Windows requirements

Device family
Windows 10 Creators Update (introduced in 10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v4.0)

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