NavigatingCancelEventArgs Class
Provides data for the Navigating event.
Assembly: PresentationFramework (in PresentationFramework.dll)
These event arguments contain information about the navigation that was requested, and are passed to handlers of the Navigating event, which is implemented by the following:
NavigatingCancelEventArgs encapsulates the following details of the navigation request:
Navigation Initiation: NavigationMode, Navigator, IsNavigationInitiator.
Navigation Request: WebRequest.
Navigation State: ExtraData, ContentStateToSave, TargetContentState.
This information allows you to both evaluate the nature of the navigation request, and view and update specified request details before navigation occurs.
Based on the navigation request information provided by NavigatingCancelEventArgs, or based on application-specific state or code, you can completely prevent navigation by setting the Cancel property to true (by default, Cancel is false).
The following example shows how to handle Navigating to detect whether a request to refresh static content was made, and if one was, how to cancel the request.
void NavigationService_Navigating(object sender, NavigatingCancelEventArgs e) { // Don't allow refreshing of a static page if ((e.NavigationMode == NavigationMode.Refresh) && (e.Uri.OriginalString == "StaticPage.xaml")) { e.Cancel = true; } }
System.EventArgs
System.ComponentModel.CancelEventArgs
System.Windows.Navigation.NavigatingCancelEventArgs
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.