AccessKey Attached Property

AutomationProperties.AccessKey Attached Property

This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets or sets the access key for the element.

Namespace:  System.Windows.Automation
Assembly:  System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.

See GetAccessKey, SetAccessKey
<object AutomationProperties.AccessKey="keyString"/>

Property Value

Type: System.String
The access key for the element.

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".

AutomationProperties.AccessKey reports the information as a string. The actual key handling would be 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 access key behavior. If you are consuming a third part control, you may need to consult available documentation for that control to determine if there is existing key handling when you use a control instance in your application. The purpose of AutomationProperties.AccessKey and the System.Windows.Automation.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.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

© 2016 Microsoft