Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Button.IsCancel Property

Gets or sets a value that indicates whether a Button is the Cancel button. A user can activate the Cancel button by pressing the Escape key.

Namespace: System.Windows.Controls
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:

public bool IsCancel { get; set; }
/** @property */
public boolean get_IsCancel ()

/** @property */
public void set_IsCancel (boolean value)

public function get IsCancel () : boolean

public function set IsCancel (value : boolean)

<object IsCancel="bool" .../>

Property Value

true if the Button is the Cancel button; otherwise, false. The default value is false.

Identifier Field


Metadata Flags


When you set the IsCancel property of a button to true, you create a Button that is registered with the AccessKeyManager. The button is then activated when a user presses the Escape key.

The following example shows how to use this property to create a Cancel button.

<Button Name="btnCancel" IsCancel="true" Click="OnClickCancel">Cancel</Button>

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
© 2018 Microsoft