Compartir a través de


AutomationProperties.AcceleratorKey Attached Property

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

Gets or sets the accelerator key string for the element.

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

Syntax

'Declaration
See GetAcceleratorKey, SetAcceleratorKey
See GetAcceleratorKey, SetAcceleratorKey
<object AutomationProperties.AcceleratorKey="keyString"/>

Property Value

Type: System.String
The accelerator key string for the element.

Remarks

Silverlight does not support accelerator keys directly. 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+C". The + sign is commonly used to denote the combination of keys.

AutomationProperties.AcceleratorKey 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 accelerator 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.AcceleratorKey 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.

Important noteImportant Note:

Silverlight is generally 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.