AutomationProperties.AccessKey attached property

Applies to Windows and Windows Phone

Gets or sets the access key for the specified element.

<object AutomationProperties.AccessKey="stringForKey" />

XAML Values


The access key string for the element.


AutomationProperties.AccessKey is an attached property, which supports a XAML usage. When getting this property in code, use GetAccessKey. When setting this property in code, use SetAccessKey. 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 AccessKeyProperty as the dependency property identifier.

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

An access key (sometimes referred to as a keyboard shortcut or mnemonic) is a character in the text of a menu, menu item, or label of a control such as a button that invokes the associated menu function. For example, to provide a shortcut way to open the File menu (for which the access key is typically "F"), an element might have this attached property set to "ALT+F".

Important  Setting this attached property does not automatically establish key-event handling for the string you specify. All the property does is enable you to notate (to assistive technologies) what the access key is. The actual key-handling behavior must be done separately, using general key-event handling code. For more info, see Responding to keyboard interactions.


Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]





See also




© 2014 Microsoft