Skip to main content

KeyEventArgs Class

Provides information specific to a keyboard event.

Definition

Namespace: Avalonia.Input
Assembly: Avalonia.Base (in Avalonia.Base.dll)

public class KeyEventArgs : RoutedEventArgs
View Source
InheritanceObjectEventArgsRoutedEventArgs → KeyEventArgs

Constructors

KeyEventArgs()Initializes a new instance of the KeyEventArgs class

Properties

HandledGets or sets a value indicating whether the routed event has already been handled.
(Inherited from RoutedEventArgs)
Key

Gets the virtual-key for the associated event.
A given physical key can result in different virtual keys depending on the current keyboard layout.
This is the key that is generally referred to when creating keyboard shortcuts.

For example, when pressing the key located at the Z position on standard US English QWERTY keyboard, this property returns:
- Z for an English (QWERTY) layout
- W for a French (AZERTY) layout
- Y for a German (QWERTZ) layout
- Z for a Russian (JCUKEN) layout

KeyDeviceTypeType of the device that fire the event
KeyModifiersGets the key modifiers for the associated event.
KeySymbol

Gets the unicode symbol of the key, or null if none is applicable.

For example, when pressing the key located at the Z position on standard US English QWERTY keyboard, this property returns:
- z for an English (QWERTY) layout
- w for a French (AZERTY) layout
- y for a German (QWERTZ) layout
- я for a Russian (JCUKEN) layout

PhysicalKey

Gets the physical key for the associated event.

This value is independent of the current keyboard layout and usually correspond to the key printed on a standard US English QWERTY keyboard.

RouteGets or sets the routing strategy (direct, bubbling, or tunneling) of the routed event.
(Inherited from RoutedEventArgs)
RoutedEventGets or sets the routed event associated with these event args.
(Inherited from RoutedEventArgs)
SourceGets or sets the source object that raised the routed event.
(Inherited from RoutedEventArgs)

Methods

Equals(Object)Determines whether the specified object is equal to the current object.
(Inherited from Object)
Finalize()Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
GetHashCode()Serves as the default hash function.
(Inherited from Object)
GetType()Gets the Type of the current instance.
(Inherited from Object)
MemberwiseClone()Creates a shallow copy of the current Object.
(Inherited from Object)
ToString()Returns a string that represents the current object.
(Inherited from Object)

See Also

Reference

Avalonia.Input Namespace