KeyboardEvent Class
https://w3c.github.io/uievents/#keyboardevent
public sealed class KeyboardEvent : UIEvent- Inheritance
UIEventKeyboardEvent
Constructors
| Name | Description |
|---|---|
| KeyboardEvent(string, KeyboardEventInit?) | Creates a keyboard event of the given type with the given initialization dictionary. |
KeyboardEvent(string, KeyboardEventInit?)
UIEvents.csCreates a keyboard event of the given type with the given initialization dictionary.
public KeyboardEvent(string type, KeyboardEventInit? eventInitDict = null)Properties
| Name | Description |
|---|---|
| AltKey | Gets a value indicating whether the Alt key was active. |
| CharCode | Gets the legacy Unicode code of the character key. |
| Code | Gets the physical key code, such as KeyA or Enter. |
| CtrlKey | Gets a value indicating whether the Control key was active. |
| IsComposing | Gets a value indicating whether the event is part of a composition session. |
| Key | Gets the value of the key, such as a or Enter. |
| KeyCode | Gets the legacy code of the key. |
| Location | Gets the location of the key on the device (standard, left, right or numpad). |
| MetaKey | Gets a value indicating whether the Meta key was active. |
| Repeat | Gets a value indicating whether the key is held down so that the event is auto-repeated. |
| ShiftKey | Gets a value indicating whether the Shift key was active. |
AltKey
UIEvents.csGets a value indicating whether the Alt key was active.
public bool AltKey { get; }CharCode
UIEvents.csGets the legacy Unicode code of the character key.
public uint CharCode { get; }Code
UIEvents.csGets the physical key code, such as KeyA or Enter.
public string Code { get; }CtrlKey
UIEvents.csGets a value indicating whether the Control key was active.
public bool CtrlKey { get; }IsComposing
UIEvents.csGets a value indicating whether the event is part of a composition session.
public bool IsComposing { get; }Key
UIEvents.csGets the value of the key, such as a or Enter.
public string Key { get; }KeyCode
UIEvents.csGets the legacy code of the key.
public uint KeyCode { get; }Location
UIEvents.csGets the location of the key on the device (standard, left, right or numpad).
public uint Location { get; }MetaKey
UIEvents.csGets a value indicating whether the Meta key was active.
public bool MetaKey { get; }Repeat
UIEvents.csGets a value indicating whether the key is held down so that the event is auto-repeated.
public bool Repeat { get; }ShiftKey
UIEvents.csGets a value indicating whether the Shift key was active.
public bool ShiftKey { get; }Methods
| Name | Description |
|---|---|
| GetModifierState(string) | Returns whether the given modifier key (such as Shift or CapsLock) was active when the event occurred. |
| InitKeyboardEvent(string, bool, bool, EventTarget?, string, uint, bool, bool, bool, bool) | https://w3c.github.io/uievents/#dom-keyboardevent-initkeyboardevent |
GetModifierState(string)
UIEvents.csReturns whether the given modifier key (such as Shift or CapsLock) was active when the event occurred.
InitKeyboardEvent(string, bool, bool, EventTarget?, string, uint, bool, bool, bool, bool)
UIEvents.cshttps://w3c.github.io/uievents/#dom-keyboardevent-initkeyboardevent
Constants
| Name | Description |
|---|---|
| DomKeyLocationLeft | The key is on the left side of the keyboard. |
| DomKeyLocationNumpad | The key is on the numeric keypad. |
| DomKeyLocationRight | The key is on the right side of the keyboard. |
| DomKeyLocationStandard | The key has a single location on the keyboard. |
DomKeyLocationLeft
The key is on the left side of the keyboard.
public const uint DomKeyLocationLeft = 1UDomKeyLocationNumpad
The key is on the numeric keypad.
public const uint DomKeyLocationNumpad = 3UDomKeyLocationRight
The key is on the right side of the keyboard.
public const uint DomKeyLocationRight = 2UDomKeyLocationStandard
The key has a single location on the keyboard.
public const uint DomKeyLocationStandard = 0U