KeyboardAccelerator KeyboardAccelerator KeyboardAccelerator KeyboardAccelerator Class


Represents a keyboard shortcut (or accelerator) that lets a user perform an action using the keyboard instead of navigating the app UI (directly or through access keys).

Accelerators are typically assigned to buttons or menu items.

public : class KeyboardAccelerator : DependencyObject
struct winrt::Windows::UI::Xaml::Input::KeyboardAccelerator : DependencyObject
public class KeyboardAccelerator : DependencyObject
Public Class KeyboardAccelerator Inherits DependencyObject

Windows 10 requirements

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


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.


KeyboardAccelerator() KeyboardAccelerator() KeyboardAccelerator() KeyboardAccelerator()

Initializes a new instance of the KeyboardAccelerator class.


Dispatcher Dispatcher Dispatcher Dispatcher

Gets the CoreDispatcher that this object is associated with. The CoreDispatcher represents a facility that can access the DependencyObject on the UI thread even if the code is initiated by a non-UI thread.

(Inherited from DependencyObject)
IsEnabled IsEnabled IsEnabled IsEnabled

Gets or sets whether a keyboard shortcut (accelerator) is available to the user.

IsEnabledProperty IsEnabledProperty IsEnabledProperty IsEnabledProperty

Identifies the IsEnabled dependency property.

Key Key Key Key

Gets or sets the virtual key (used in conjunction with one or more modifier keys) for a keyboard shortcut (accelerator).

A keyboard shortcut is invoked when the modifier keys associated with the shortcut are pressed and then the non-modifier key is pressed at the same time. For example, Ctrl+C for copy and Ctrl+S for save.

KeyProperty KeyProperty KeyProperty KeyProperty

Identifies the Key dependency property.

Modifiers Modifiers Modifiers Modifiers

Gets or sets the virtual key used to modify another keypress for a keyboard shortcut (accelerator).

A keyboard shortcut is invoked when the modifier keys associated with the shortcut are pressed and then the non-modifier key is pressed at the same time. For example, Ctrl+C for copy and Ctrl+S for save.

ModifiersProperty ModifiersProperty ModifiersProperty ModifiersProperty

Identifies the Modifiers dependency property.

ScopeOwner ScopeOwner ScopeOwner ScopeOwner

Gets or sets the scope (or target) of the keyboard accelerator.

ScopeOwnerProperty ScopeOwnerProperty ScopeOwnerProperty ScopeOwnerProperty

Identifies the ScopeOwner dependency property.


Invoked Invoked Invoked Invoked

Occurs when the key combination for this KeyboardAccelerator is pressed.


ClearValue(DependencyProperty) ClearValue(DependencyProperty) ClearValue(DependencyProperty) ClearValue(DependencyProperty)

Clears the local value of a dependency property.

(Inherited from DependencyObject)
GetAnimationBaseValue(DependencyProperty) GetAnimationBaseValue(DependencyProperty) GetAnimationBaseValue(DependencyProperty) GetAnimationBaseValue(DependencyProperty)

Returns any base value established for a dependency property, which would apply in cases where an animation is not active.

(Inherited from DependencyObject)
GetValue(DependencyProperty) GetValue(DependencyProperty) GetValue(DependencyProperty) GetValue(DependencyProperty)

Returns the current effective value of a dependency property from a DependencyObject.

(Inherited from DependencyObject)
ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty)

Returns the local value of a dependency property, if a local value is set.

(Inherited from DependencyObject)
RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback) RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback) RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback) RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback)

Registers a notification function for listening to changes to a specific DependencyProperty on this DependencyObject instance.

(Inherited from DependencyObject)
SetValue(DependencyProperty,Object) SetValue(DependencyProperty,Object) SetValue(DependencyProperty,Object) SetValue(DependencyProperty,Object)

Sets the local value of a dependency property on a DependencyObject.

(Inherited from DependencyObject)
UnregisterPropertyChangedCallback(DependencyProperty,Int64) UnregisterPropertyChangedCallback(DependencyProperty,Int64) UnregisterPropertyChangedCallback(DependencyProperty,Int64) UnregisterPropertyChangedCallback(DependencyProperty,Int64)

Cancels a change notification that was previously registered by calling RegisterPropertyChangedCallback.

(Inherited from DependencyObject)

See also