RoutedPropertyChangingEventArgs<T>.Cancel Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets a value that determines whether the property change that originated the RoutedPropertyChanging event should be cancelled.

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

Syntax

'Declaration
Public Property Cancel As Boolean
public bool Cancel { get; set; }

Property Value

Type: System.Boolean
true to cancel the property change; this resets the property to OldValue. false to not cancel the property change; the value changes to NewValue.

Exceptions

Exception Condition
InvalidOperationException

Attempted to cancel in an instance where IsCancelable is false.

Remarks

Always check IsCancelable first in your event handling before attempting to set Cancel to true.

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

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