Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Page.NavigationService Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets the navigation service that the host of the page is using to manage navigation.

Namespace:   System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

public NavigationService NavigationService { get; }

Property Value

Type: System.Windows.Navigation.NavigationService

The NavigationService object that the host of the page is using to manage navigation, or null if the host does not support navigation.

Pages can be hosted by multiple types of hosts, including Window, NavigationWindow, Frame, and a browser.

Pages often need to integrate with their host's navigation to provide in-page navigation support. However, because a page may not know what its host will be at run time, it cannot integrate directly with its host's navigation members to do so.

Instead, it can attempt to use a navigation service, which is a service that supports browser-style navigation and is encapsulated by the NavigationService class. You cannot create your own NavigationService instance, though. Instead, host types such as NavigationWindow, Frame, or a browser create their own NavigationService instance that you can access from the NavigationService property.

The navigation service that is returned from the NavigationService property is the instance of the NavigationService class that is managed by the first navigator up the visual tree. If one is not found, null is returned, indicating a page's host does not support navigation.


The Window class does not support navigation and does not provide a navigation service.

The following example shows how a page can check if a navigation service is available and, if so, use it to navigate back to the previous page.

public partial class HomePage : Page
    public HomePage()

        // Don't allow back navigation if no navigation service
        if (this.NavigationService != null)
            this.goBackButton.IsEnabled = false;

    void goBackButton_Click(object sender, RoutedEventArgs e)
        // Go to previous entry in journal back stack
        if (this.NavigationService.CanGoBack)

.NET Framework
Available since 3.0
Available since 3.0
Windows Phone Silverlight
Available since 7.0
Return to top
© 2018 Microsoft