title | description | ms.date | dev_langs | helpviewer_keywords | ms.assetid | ||||
---|---|---|---|---|---|---|---|---|---|
How to: Navigate Back Through Navigation History |
Learn how to navigate back through navigation history, by means of the included code examples in C# and Visual Basic. |
03/30/2017 |
|
|
9343234b-d864-441d-b8a7-d895cba80a87 |
This example illustrates how to navigate to entries in back navigation history.
Code that is running from content that is hosted in a xref:System.Windows.Navigation.NavigationWindow, xref:System.Windows.Controls.Frame using xref:System.Windows.Navigation.NavigationService, or 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:
[!code-csharpHOWTONavigationSnippets#NavigateBackCODE] [!code-vbHOWTONavigationSnippets#NavigateBackCODE]
CanGoBack and GoBack are implemented by xref:System.Windows.Navigation.NavigationWindow, xref:System.Windows.Controls.Frame, and xref:System.Windows.Navigation.NavigationService.
Note
If you call GoBack, and there are no entries in back navigation history, an xref:System.InvalidOperationException is raised.