AutomationProperties.AcceleratorKey attached property
Collapse the table of content
Expand the table of content

AutomationProperties.AcceleratorKey attached property

Gets or sets the accelerator key for the specified element.

<object AutomationProperties.AcceleratorKey="stringForKey" />

XAML Values


The accelerator key string for the element.


AutomationProperties.AcceleratorKey is an attached property, which supports a XAML usage. When getting this property in code, use GetAcceleratorKey. When setting this property in code, use SetAcceleratorKey instead. In code usages, the target parameter is the object where the attached property value is set. Another way to get or set the value in code is to use the dependency property system, calling either GetValue or SetValue and passing AcceleratorKeyProperty as the dependency property identifier.

The purpose of AutomationProperties.AcceleratorKey and the AutomationProperties attached properties is to provide instance values for behavior that are not already present or defined in the control definition or a control's applied generic template.

If an application responds to keyboard events to provide shortcut key behavior, it should return a string that contains the keyboard shortcut combination. For example, for an element that can copy text to the clipboard, this attached property might be set to the value "CTRL+ALT+C". The "+" sign is commonly used to denote the combination of keys. AutomationProperties.AcceleratorKey reports the information as a string, but setting the string does not result in any logic. The actual key handling is done by writing a handler for KeyDown or KeyUp on the control class, or in some cases by overriding any existing OnKeyDown or OnKeyUp from base classes. Control implementations might already implement accelerator key behavior. If you are consuming a third party control, you might need to consult available documentation for that control to determine whether there is existing key handling when you use a control instance in your application.

Requirements (Windows 10 device family)

Device family

API contract




Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]





See also




© 2016 Microsoft