Frame.Navigate(TypeName, Object, NavigationTransitionInfo) method

Applies to Windows and Windows Phone

Causes the Frame to load content represented by the specified Page-derived data type, also passing a parameter to be interpreted by the target of the navigation, and a value indicating the animated transition to use.

Syntax


public:
bool Navigate(
  TypeName sourcePageType, 
  Object^ parameter, 
  NavigationTransitionInfo^ infoOverride
)

Parameters

sourcePageType

Type: System.Type [.NET] | TypeName [C++]

The page to navigate to, specified as a type reference to its partial class type. (A type reference is given as System.Type for .NET, or a TypeName helper struct for C++/CX).

parameter

Type: System.Object [.NET] | Platform::Object [C++]

The navigation parameter to pass to the target page; must have a basic type (string, char, numeric, or GUID) to support parameter serialization using GetNavigationState.

infoOverride

Type: NavigationTransitionInfo

Info about the animated transition.

Return value

Type: System.Boolean [.NET] | Platform::Boolean [C++]

false if a NavigationFailed event handler has set Handled to true; otherwise, true. See Remarks for more info.

Remarks

Currently, you must handle the NavigationFailed event to respond to navigation failure. You can handle the failure directly in the event handler, or you can set the NavigationFailedEventArgs.Handled property to true and use the Navigate method return value to respond to the failure.

Apps typically use GetNavigationState to serialize the frame’s state when the app suspends. You can do this directly in your app code or indirectly by using the SuspensionManager class generated by the Visual Studio templates. To enable frame state serialization using GetNavigationState, you must use only basic types for the navigation parameter, such as string, char, numeric, and GUID types. Otherwise GetNavigationState will throw an exception when the app suspends. The parameter can have other types if you do not use GetNavigationState.

The parameter value can have a complex type if you do not use GetNavigationState. However, you should still use only basic types in order to avoid excess memory usage caused by the frame’s navigation stack holding a reference to the parameter.

Tip  If you are programming using a .NET language (C# or Microsoft Visual Basic), the TypeName type projects as System.Type. When programming using C#, it is common to use the typeof operator to get references to the System.Type of a type. In Visual Basic, use GetType. If you're using C++/CX, where you'll need to create a TypeName helper struct, you can use the typeid component extension.

Requirements

Minimum supported client

Windows 8.1

Minimum supported server

Windows Server 2012 R2

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml.Controls
Windows::UI::Xaml::Controls [C++]

Metadata

Windows.winmd

See also

Frame
Navigate(Type, Object)
Navigate(Type)
Quickstart: Navigating between pages
XAML Navigation sample

 

 

Show:
© 2014 Microsoft