Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
/** @event */ public void add_Navigating (NavigatingCancelEventHandler value) /** @event */ public void remove_Navigating (NavigatingCancelEventHandler value)
In JScript, you can handle the events defined by a class, but you cannot define your own.
Navigating 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 Navigating 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 Navigating 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.
You also handle NavigatingCancelEventArgs to cancel navigation, if required, by setting Cancel to true. If you cancel navigation, no other navigation events are raised.
If your application is hosted in the browser, you cannot prevent the user from navigating away from your application by canceling the Navigating 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 Navigating to detect whether a request to refresh static content has been made and, if so, to cancel the request.
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter EditionThe Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.
Other ResourcesRemember A Single Item of State Across Page Instances
Remember A Single Set of State Across Page Instances
Remember Multiple Sets of State Per Page Instance