Export (0) Print
Expand All
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

AutomationPeer.GetAcceleratorKey Method

July 28, 2014

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

Gets the accelerator key combination for the object that is associated with the UI Automation peer.

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

public string GetAcceleratorKey()

Return Value

Type: System.String
The accelerator key combination hint string.

This implementation does nothing more than calling GetAcceleratorKeyCore from the specific peer where GetAcceleratorKey is invoked.

Windows Phone does not support accelerator keys directly as a high-level input model. If a control implementation responds to keyboard events to provide key access/accelerator behavior as part of its built-in code handling, the peer for the control should specify a string that contains the keyboard accelerator key combination. To actually handle the key combination, the control should have built-in key handling logic, which is typically implemented by overriding OnKeyDown(KeyEventArgs) or OnKeyUp(KeyEventArgs) and writing specific logic for the indicated key combination. Alternatively, usercode for a control instances could define handlers for KeyDown or KeyUp.

If a control has an accelerator key that is reported as part of the related peer implementation, this means that the control has a singular action or a primary action that can be invoked when the user presses the indicated key or key combination on the keyboard. Specific implementations of GetAcceleratorKeyCore in Windows Phone controls are relatively rare. Most of the existing implementations are addressing containment scenarios: making sure that a contained item can forward its own accelerator key information to the level of the container. An example of an implementation that does this is ItemAutomationPeer.GetAcceleratorKeyCore().

Rather than specifying accelerator keys as built-in control behaviors, it is more common for Windows Phone app user code to specify the accelerators that are relevant to control instances as used in a specific Windows Phone app UI. In this case, accelerator keys are specified by setting the attached property AutomationProperties.AcceleratorKey on that control instance. This is typically done in the XAML that defines the UI.

The difference between access keys and accelerator keys is as follows. Access keys are primarily for menu items and are generally specified as a single letter. That letter is underlined in a typical menu's visual appearance. Accelerators are usually valid whenever the control has focus, and are not limited to menu concepts or the fact that a menu is open. Note that Windows Phone does not have high-level menu API in its core API set.

Important noteImportant Note:

The browser host might not report all possible key events to the Windows Phone input system, often because the browser host might handle that key event itself.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2014 Microsoft