Occurs when a new navigation is requested.
Assembly: PresentationFramework (in PresentationFramework.dll)
is raised when a new navigation is requested, but before the source content is requested, including when:
Navigate is called.
A content fragment is navigated to.
You handle if you need to discover pertinent information regarding the navigation request before navigation starts. This information is available from the NavigatingCancelEventArgs object that is passed to the event handler.
A WebRequest object for the navigation is created and available from the NavigatingCancelEventArgs parameter; because the actual request hasn't been made at this point, you can reconfigure the WebRequest object, if necessary.
If your application is hosted in the browser, you cannot prevent the user from navigating away from your application by canceling the event.
After the first piece of content is navigated to by a navigator (NavigationWindow, Frame), each piece of content that is navigated away from is added to navigation history. If you need to save state information about the content you are navigating away from, you can add the state to the journal entry for that content by setting ContentStateToSave with a CustomContentState object.
The following example shows how to handle to detect whether a request to refresh static content has been made and, if so, to cancel the request.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.