Defines a keyboard combination that can be used to invoke a command.
Assembly: PresentationCore (in PresentationCore.dll)
Initializes a new instance of the Key.class with the specified
|KeyGesture(Key, ModifierKeys, String)|
Determines whether the specified object is equal to the current object.(Inherited from Object.)
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)
Returns a string that can be used to display the.
Serves as the default hash function. (Inherited from Object.)
Returns a string that represents the current object.(Inherited from Object.)
In most cases, a ModifierKeys. The exceptions to this rule are the function keys and the numeric keypad keys, which can be a valid by themselves. For example, you can create a by using only the F12 key, but to use the X key in a it must be paired with a modifier key.must be associated with one or more
In general, you can
For Gesture, in cases where the gesture represents both a standard key and a modifier key. You can also set the Gesture property to be just a function key, or just a modifier key combination. However, it is more common to set the Key property if the intended command binding is a function key with no modifiers, or Modifiers if the intended command binding is for modifier keys only.XAML usages, the property that is generally set in XAML is
The following example shows how to use <KeyGesture> element. That object element usage is not possible because does not expose a public default constructor. Instead, the XAML usage uses the typeconverter behavior to declare an entire inline as the Gesture attribute value.in XAML. Note that the XAML usage does not directly declare a
Available since 3.0
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.