UIElement.KeyboardAccelerators UIElement.KeyboardAccelerators UIElement.KeyboardAccelerators UIElement.KeyboardAccelerators Property

Definition

Gets the the collection of key combinations that invoke an action using the keyboard.

Accelerators are typically assigned to buttons or menu items.

Example of a menu showing keyboard accelerators for various menu items

Example of a menu showing keyboard accelerators for various menu items

public : IVector<KeyboardAccelerator> KeyboardAccelerators { get; }
IVector<KeyboardAccelerator> KeyboardAccelerators();
public IList<KeyboardAccelerator> KeyboardAccelerators { get; }
Public ReadOnly Property KeyboardAccelerators As IList<KeyboardAccelerator>
Property Value
IList<KeyboardAccelerator> IList<KeyboardAccelerator>

The collection of KeyboardAccelerator objects.

Additional features and requirements
Device family
Windows 10 Fall Creators Update (introduced v10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)

Remarks

Windows 10, version 1703, introduced keyboard accelerator shortcuts. However, these shortcuts were not displayed with the UI of their corresponding controls.

Starting with Windows 10, version 1803, when KeyboardAccelerators are declared, controls present the corresponding key combinations by default (unless they are associated with MenuFlyoutItem and ToggleMenuFlyoutItem objects).

You can override the the default key combination string associated with a keyboard accelerator using the text override properties MenuFlyoutItem.KeyboardAcceleratorTextOverride, AppBarButton.KeyboardAcceleratorTextOverride, and AppBarToggleButton.KeyboardAcceleratorTextOverride.

An accelerator key can be a single key, such as F1 - F12 and Esc, or a combination of keys (Ctrl + Shift + B, or Ctrl C) that invoke a command. They differ from access keys (mnemonics), which are typically modified with the Alt key and simply activate a command or control.

An accelerator can be executed even if the element associated with the accelerator is not visible. For example, an item in the SecondaryCommands collection of the CommandBar can be invoked using an accelerator without expanding the overflow menu and displaying the element.

By default, an accelerator has global scope. However, you can constrain scope using ScopeOwner or disable an accelerator completely using IsEnabled.

See Also