Windows Presentation Foundation (WPF) implements a navigation history service that stores one entry for each piece of content that has been previously navigated to, just like navigation history in Microsoft Internet Explorer. Navigation history comprises two stacks, one that remembers back navigation history, and one that remembers forward navigation history.
An entry for the current item is added to back navigation history when a forward navigation occurs. This occurs in the following situations:
Likewise, an entry for the current item is added to forward navigation history before a back navigation occurs, which happens when:
Each entry in back and forward navigation history is an instance of the JournalEntry class.
Each JournalEntry object encapsulates information about a particular navigation, including a name for the entry (Name), whether the entry is kept alive (KeepAlive) and the uniform resource identifier (URI) for the content that is navigated to (Source).
You can retrieve all the JournalEntry objects in back navigation history by enumerating the NavigationWindow..::.BackStack or Frame..::.BackStack properties. For forward navigation history, you can retrieve all the JournalEntry objects by enumerating the NavigationWindow..::.ForwardStack or Frame..::.ForwardStack properties.
If you need to remove the most recent JournalEntry object from back navigation history, to prevent navigation to it, for example, you can call the RemoveBackEntry method (NavigationService..::.RemoveBackEntry, NavigationWindow..::.RemoveBackEntry, Frame..::.RemoveBackEntry), which removes the JournalEntry object and returns a reference to it.
You cannot add JournalEntry objects to navigation history, however, because you can neither instantiate nor derive from JournalEntry, and because no type implements a member to do so. However, you can add custom CustomContentState objects to back navigation history by calling the AddBackEntry method (AddBackEntry, AddBackEntry, AddBackEntry); NavigationService adds the CustomContentState object to an internally-created JournalEntry object, which is then added to the back navigation history.