Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
How to: Navigate Back Through Navigation History

How to: Navigate Back Through Navigation History

This example illustrates how to navigate to entries in back navigation history.

Code that is running from content that is hosted in a NavigationWindow, Frame use NavigationService, or Windows Internet Explorer can navigate back through navigation history, one entry at a time.

Navigating back one entry requires first checking that there are entries in back navigation history, by inspecting the CanGoBack property, before navigating back one entry, by calling the GoBack method. This is illustrated in the following example:

void navigateBackButton_Click(object sender, RoutedEventArgs e)
    // Navigate back one page from this page, if there is an entry
    // in back navigation history
    if (this.NavigationService.CanGoBack)
        MessageBox.Show("No entries in back navigation history.");

CanGoBack and GoBack are implemented by NavigationWindow, Frame, and NavigationService.


If you call GoBack, and there are no entries in back navigation history, an InvalidOperationException is raised.

© 2015 Microsoft