ClosingEventArgs.IsCancelable Property

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

Gets a value that indicates whether you can cancel the Window.Closing event.

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

Syntax

'Declaration
Public ReadOnly Property IsCancelable As Boolean
public bool IsCancelable { get; }

Property Value

Type: System.Boolean
true if you can cancel the event; otherwise, false.

Remarks

Use the ClosingEventArgs.IsCancelable property to determine whether you can cancel the Window.Closing event. You can cancel the event and prevent the window from closing by setting the Cancel property to true. However, this works only if the event occurred because the Close method was called, or the user clicked the Close button or pressed ALT+F4. You cannot cancel the event if the window is closing for some other reason, such as system shutdown.

Version Information

Silverlight

Supported in: 5, 4

Platforms

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