Export (0) Print
Expand All

NavigatingCancelEventArgs Class

Provides data for the Navigating event.

Namespace: System.Windows.Navigation
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

'Declaration
Public Class NavigatingCancelEventArgs
	Inherits CancelEventArgs
'Usage
Dim instance As NavigatingCancelEventArgs

public class NavigatingCancelEventArgs extends CancelEventArgs
public class NavigatingCancelEventArgs extends CancelEventArgs
You cannot use this managed class in XAML.

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:

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 has been made and, if so, to cancel the request.

Navigating.

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.Object
   System.EventArgs
     System.ComponentModel.CancelEventArgs
      System.Windows.Navigation.NavigatingCancelEventArgs

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

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 Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2014 Microsoft