共用方式為


AutomationProperties.GetAccessKey Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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

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

Syntax

'Declaration
Public Shared Function GetAccessKey ( _
    element As DependencyObject _
) As String
public static string GetAccessKey(
    DependencyObject element
)

Parameters

Return Value

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

Exceptions

Exception Condition
ArgumentException

element is invalid value.

ArgumentNullException

element is nulla null reference (Nothing in Visual Basic).

Remarks

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.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

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

Platforms

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