KeyboardAccelerator Class
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 327680)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class KeyboardAccelerator : DependencyObject
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 327680)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public class KeyboardAccelerator : DependencyObject
Public Class KeyboardAccelerator
Inherits DependencyObject
- Inheritance
- Attributes
Device family |
Windows 10 Fall Creators Update (introduced in 10.0.16299.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v5.0)
|
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.
Keyboard |
Initializes a new instance of the KeyboardAccelerator class. |
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) |
Is |
Gets or sets whether a keyboard shortcut (accelerator) is available to the user. |
Is |
Identifies the IsEnabled dependency property. |
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. |
Key |
Identifies the Key dependency property. |
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. |
Modifiers |
Identifies the Modifiers dependency property. |
Scope |
Gets or sets the scope (or target) of the keyboard accelerator. |
Scope |
Identifies the ScopeOwner dependency property. |
Clear |
Clears the local value of a dependency property. (Inherited from DependencyObject) |
Get |
Returns any base value established for a dependency property, which would apply in cases where an animation is not active. (Inherited from DependencyObject) |
Get |
Returns the current effective value of a dependency property from a DependencyObject. (Inherited from DependencyObject) |
Read |
Returns the local value of a dependency property, if a local value is set. (Inherited from DependencyObject) |
Register |
Registers a notification function for listening to changes to a specific DependencyProperty on this DependencyObject instance. (Inherited from DependencyObject) |
Set |
Sets the local value of a dependency property on a DependencyObject. (Inherited from DependencyObject) |
Unregister |
Cancels a change notification that was previously registered by calling RegisterPropertyChangedCallback. (Inherited from DependencyObject) |
Invoked |
Occurs when the key combination for this KeyboardAccelerator is pressed. |
Product | Versions |
---|---|
WinRT | Build 16299, Build 17134, Build 17763, Build 18362, Build 19041, Build 20348, Build 22000, Build 22621, Build 26100 |