NavigatingCancelEventArgs Class
Provides data for the Navigating event.
System::EventArgs
System.ComponentModel::CancelEventArgs
System.Windows.Navigation::NavigatingCancelEventArgs
Assembly: PresentationFramework (in PresentationFramework.dll)
The NavigatingCancelEventArgs type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | Cancel | Gets or sets a value indicating whether the event should be canceled. (Inherited from CancelEventArgs.) |
![]() | Content | Gets a reference to the content object that is being navigated to. |
![]() | ContentStateToSave | Gets and sets the CustomContentState object that is associated with the back navigation history entry for the page being navigated from. |
![]() | ExtraData | Gets the optional data Object that was passed when navigation started. |
![]() | IsNavigationInitiator | Indicates whether the navigator (NavigationWindow, Frame) that is specified by Navigator is servicing this navigation, or whether a parent navigator is doing so. |
![]() | NavigationMode | Gets a NavigationMode value that indicates the type of navigation that is occurring. |
![]() | Navigator | The navigator that raised this event. |
![]() | TargetContentState | Gets the CustomContentState object that is to be applied to the content being navigated to. |
![]() | Uri | Gets the uniform resource identifier (URI) for the content being navigated to. |
![]() | WebRequest | Gets the WebRequest object that is used to request the specified content. |
| Name | Description | |
|---|---|---|
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
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.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
