NavigatingCancelEventArgs Class
Provides data for the OnNavigatingFrom method and the Navigating event.
System.EventArgs
System.ComponentModel.CancelEventArgs
System.Windows.Navigation.NavigatingCancelEventArgs
Namespace: System.Windows.Navigation
Assembly: System.Windows (in System.Windows.dll)
The NavigatingCancelEventArgs type exposes the following members.
| Name | Description | |
|---|---|---|
![]() ![]() | NavigatingCancelEventArgs(Uri, NavigationMode) | Initializes a new instance of the NavigatingCancelEventArgs class, based on URI and mode. |
![]() ![]() | NavigatingCancelEventArgs(Uri, NavigationMode, Boolean, Boolean) | Initializes a new instance of the NavigatingCancelEventArgs class, setting all initial property values. |
| Name | Description | |
|---|---|---|
![]() ![]() | Cancel | Gets or sets a value that indicates whether the operation should be canceled. (Inherited from CancelEventArgs.) |
![]() ![]() | IsCancelable | Gets a value that indicates whether you can cancel the navigation. |
![]() ![]() | IsNavigationInitiator | Gets a value that indicates whether the current application is the origin and destination of the navigation. |
![]() ![]() | NavigationMode | Gets a value that indicates the type of navigation that is occurring. |
![]() ![]() | Uri | Gets the uniform resource identifier (URI) for the content that is being navigated to. |
| 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 the Object 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.) |
The NavigatingCancelEventArgs object provides event arguments for the OnNavigatingFrom method on a Page or the Navigating event. The Navigating event is raised or the OnNavigatingFrom method is called just before navigating from a page.
You can prevent a navigation request by setting the Cancel property to true. To evaluate a navigation request, you can examine the values of the NavigationMode and Uri properties.
The following example shows how to override the OnNavigatingFrom method and use the NavigatingCancelEventArgs object to determine if a child window is displayed.
Partial Public Class About Inherits Page Public Sub New() InitializeComponent() End Sub Protected Overrides Sub OnNavigatingFrom(ByVal e As System.Windows.Navigation.NavigatingCancelEventArgs) If (e.Uri.ToString().Contains("/Home")) Then Dim surveyChildWindow As New SurveyWindow surveyChildWindow.Show() End If MyBase.OnNavigatingFrom(e) End Sub End Class
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.



