Export (0) Print
Expand All

NavigatingCancelEventArgs Class

Provides data for the OnNavigatingFrom method and the Navigating event.

System.Object
  System.EventArgs
    System.ComponentModel.CancelEventArgs
      System.Windows.Navigation.NavigatingCancelEventArgs

Namespace:  System.Windows.Navigation
Assembly:  System.Windows (in System.Windows.dll)

[TypeForwardedFromAttribute("System.Windows.Controls.Navigation, Version=2.0.5.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
public sealed class NavigatingCancelEventArgs : CancelEventArgs

The NavigatingCancelEventArgs type exposes the following members.

  NameDescription
Public methodSupported by Silverlight for Windows PhoneNavigatingCancelEventArgs(Uri, NavigationMode)Initializes a new instance of the NavigatingCancelEventArgs class, based on URI and mode.
Public methodSupported by Silverlight for Windows PhoneNavigatingCancelEventArgs(Uri, NavigationMode, Boolean, Boolean)Initializes a new instance of the NavigatingCancelEventArgs class, setting all initial property values.
Top

  NameDescription
Public propertySupported by Silverlight for Windows PhoneCancelGets or sets a value that indicates whether the operation should be canceled. (Inherited from CancelEventArgs.)
Public propertySupported by Silverlight for Windows PhoneIsCancelableGets a value that indicates whether you can cancel the navigation.
Public propertySupported by Silverlight for Windows PhoneIsNavigationInitiatorGets a value that indicates whether the current application is the origin and destination of the navigation.
Public propertySupported by Silverlight for Windows PhoneNavigationModeGets a value that indicates the type of navigation that is occurring.
Public propertySupported by Silverlight for Windows PhoneUriGets the uniform resource identifier (URI) for the content that is being navigated to.
Top

  NameDescription
Public methodSupported by Silverlight for Windows PhoneEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodSupported by Silverlight for Windows PhoneFinalizeAllows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodSupported by Silverlight for Windows PhoneMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneToStringReturns a string that represents the current object. (Inherited from Object.)
Top

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.


public partial class About : Page
{
    public About()
    {
        InitializeComponent();
    }


    protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
    {
        if (e.Uri.ToString().Contains("/Home"))
        {
            SurveyWindow surveyChildWindow = new SurveyWindow();
            surveyChildWindow.Show();
        }

        base.OnNavigatingFrom(e);

    }
}


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Community Additions

ADD
Show:
© 2014 Microsoft