GetAccessKey Method

AutomationProperties.GetAccessKey Method

Gets the value of the AutomationProperties.AccessKey attached property for the specified DependencyObject.

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

public static string GetAccessKey(
	DependencyObject element


Type: System.Windows.DependencyObject
The DependencyObject to check.

Return Value

Type: System.String
The access key, as a string.


element is invalid value.


element is null.

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 noteImportant Note:

Silverlight is often hosted within a browser. The browser host might not report all possible key events to the Silverlight input system, often because the browser host might handle that key event itself. For details on this concept, see "Browser Hosts and Key Events" section of Keyboard Support.


Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

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

Community Additions

© 2015 Microsoft