Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

How to: Navigate Forward Through Navigation History

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

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

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


void navigateForwardButton_Click(object sender, RoutedEventArgs e)
{
    // Navigate forward one page from this page, if there is an entry
    // in forward navigation history
    if (this.NavigationService.CanGoForward)
    {
        this.NavigationService.GoForward();
    }
    else
    {
        MessageBox.Show("No entries in forward navigation history.");
    }
}


CanGoForward and GoForward are implemented by NavigationWindow, Frame, and NavigationService.

NoteNote

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

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.