NavigationService Class

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Provides methods, properties, and events to support navigation within a XAML application.

Inheritance Hierarchy

System..::.Object
System.Windows.Navigation..::.NavigationService

Namespace: System.Windows.Navigation
Assembly: Microsoft.Phone (in Microsoft.Phone.dll)

Syntax

Public NotInheritable Class NavigationService
public sealed class NavigationService

The NavigationService type exposes the following members.

Properties

Name Description
BackStack Gets the backstack, as an enumerator of JournalEntry objects.
CanGoBack Gets a value that indicates whether there is at least one entry in the back navigation history.
CanGoForward Gets a value that indicates whether there is at least one entry in the forward navigation history.
CurrentSource Gets the uniform resource identifier (URI) of the content that is currently displayed.
PauseOnBack Indicates whether the app should be paused or closed when Back is pressed.
Source Gets or sets the uniform resource identifier (URI) of the current content or the content that is being navigated to.

Top

Methods

Name Description
Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Finalize Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
GetType Gets the Type of the current instance. (Inherited from Object.)
GoBack Navigates to the most recent entry in the back navigation history, or throws an exception if no entry exists in back navigation.
GoForward Navigates to the most recent entry in the forward navigation history, or throws an exception if no entry exists in forward navigation.
MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Navigate Navigates to the content specified by the uniform resource identifier (URI).
RemoveBackEntry Removes the most recent entry from the back stack.
StopLoading Stops asynchronous navigations that have not yet been processed.
ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Events

Name Description
FragmentNavigation Occurs when navigation to a content fragment begins.
JournalEntryRemoved Occurs when the journal entry is removed from the navigation history.
Navigated Occurs when the content that is being navigated to has been found and is available.
Navigating Occurs when a new navigation is requested.
NavigationFailed Occurs when an error is encountered while navigating to the requested content.
NavigationStopped Occurs when the StopLoading method is called, or when a new navigation is requested while the current navigation is in progress.

Top

Remarks

You use the NavigationService class from within a page. It enables you to access the navigation service used by the hosting frame and launch new navigation requests. You can retrieve the navigation service through the NavigationService property of the Page class.

When navigating from within the frame, you use the navigation methods on the frame. The Frame class contains many of the same methods and properties as the NavigationService class.

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Platforms

Windows Phone

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

System.Windows.Navigation Namespace

Other Resources

In-app navigation for Windows Phone 8