Key Enum
Definition
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.
Specifies the possible key values on a keyboard.
public enum class Key
[System.ComponentModel.TypeConverter(typeof(System.Windows.Input.KeyConverter))]
public enum Key
[<System.ComponentModel.TypeConverter(typeof(System.Windows.Input.KeyConverter))>]
type Key =
Public Enum Key
- Inheritance
- Attributes
Fields
Name | Value | Description |
---|---|---|
None | 0 | No key pressed. |
Cancel | 1 | The Cancel key. |
Back | 2 | The Backspace key. |
Tab | 3 | The Tab key. |
LineFeed | 4 | The Linefeed key. |
Clear | 5 | The Clear key. |
Enter | 6 | The Enter key. |
Return | 6 | The Return key. |
Pause | 7 | The Pause key. |
Capital | 8 | The Caps Lock key. |
CapsLock | 8 | The Caps Lock key. |
HangulMode | 9 | The IME Hangul mode key. |
KanaMode | 9 | The IME Kana mode key. |
JunjaMode | 10 | The IME Junja mode key. |
FinalMode | 11 | The IME Final mode key. |
HanjaMode | 12 | The IME Hanja mode key. |
KanjiMode | 12 | The IME Kanji mode key. |
Escape | 13 | The ESC key. |
ImeConvert | 14 | The IME Convert key. |
ImeNonConvert | 15 | The IME NonConvert key. |
ImeAccept | 16 | The IME Accept key. |
ImeModeChange | 17 | The IME Mode change request. |
Space | 18 | The Spacebar key. |
PageUp | 19 | The Page Up key. |
Prior | 19 | The Page Up key. |
Next | 20 | The Page Down key. |
PageDown | 20 | The Page Down key. |
End | 21 | The End key. |
Home | 22 | The Home key. |
Left | 23 | The Left Arrow key. |
Up | 24 | The Up Arrow key. |
Right | 25 | The Right Arrow key. |
Down | 26 | The Down Arrow key. |
Select | 27 | The Select key. |
28 | The Print key. |
|
Execute | 29 | The Execute key. |
PrintScreen | 30 | The Print Screen key. |
Snapshot | 30 | The Print Screen key. |
Insert | 31 | The Insert key. |
Delete | 32 | The Delete key. |
Help | 33 | The Help key. |
D0 | 34 | The 0 (zero) key. |
D1 | 35 | The 1 (one) key. |
D2 | 36 | The 2 key. |
D3 | 37 | The 3 key. |
D4 | 38 | The 4 key. |
D5 | 39 | The 5 key. |
D6 | 40 | The 6 key. |
D7 | 41 | The 7 key. |
D8 | 42 | The 8 key. |
D9 | 43 | The 9 key. |
A | 44 | The A key. |
B | 45 | The B key. |
C | 46 | The C key. |
D | 47 | The D key. |
E | 48 | The E key. |
F | 49 | The F key. |
G | 50 | The G key. |
H | 51 | The H key. |
I | 52 | The I key. |
J | 53 | The J key. |
K | 54 | The K key. |
L | 55 | The L key. |
M | 56 | The M key. |
N | 57 | The N key. |
O | 58 | The O key. |
P | 59 | The P key. |
Q | 60 | The Q key. |
R | 61 | The R key. |
S | 62 | The S key. |
T | 63 | The T key. |
U | 64 | The U key. |
V | 65 | The V key. |
W | 66 | The W key. |
X | 67 | The X key. |
Y | 68 | The Y key. |
Z | 69 | The Z key. |
LWin | 70 | The left Windows logo key (Microsoft Natural Keyboard). |
RWin | 71 | The right Windows logo key (Microsoft Natural Keyboard). |
Apps | 72 | The Application key (Microsoft Natural Keyboard). Also known as the Menu key, as it displays an application-specific context menu. |
Sleep | 73 | The Computer Sleep key. |
NumPad0 | 74 | The 0 key on the numeric keypad. |
NumPad1 | 75 | The 1 key on the numeric keypad. |
NumPad2 | 76 | The 2 key on the numeric keypad. |
NumPad3 | 77 | The 3 key on the numeric keypad. |
NumPad4 | 78 | The 4 key on the numeric keypad. |
NumPad5 | 79 | The 5 key on the numeric keypad. |
NumPad6 | 80 | The 6 key on the numeric keypad. |
NumPad7 | 81 | The 7 key on the numeric keypad. |
NumPad8 | 82 | The 8 key on the numeric keypad. |
NumPad9 | 83 | The 9 key on the numeric keypad. |
Multiply | 84 | The Multiply key. |
Add | 85 | The Add key. |
Separator | 86 | The Separator key. |
Subtract | 87 | The Subtract key. |
Decimal | 88 | The Decimal key. |
Divide | 89 | The Divide key. |
F1 | 90 | The F1 key. |
F2 | 91 | The F2 key. |
F3 | 92 | The F3 key. |
F4 | 93 | The F4 key. |
F5 | 94 | The F5 key. |
F6 | 95 | The F6 key. |
F7 | 96 | The F7 key. |
F8 | 97 | The F8 key. |
F9 | 98 | The F9 key. |
F10 | 99 | The F10 key. |
F11 | 100 | The F11 key. |
F12 | 101 | The F12 key. |
F13 | 102 | The F13 key. |
F14 | 103 | The F14 key. |
F15 | 104 | The F15 key. |
F16 | 105 | The F16 key. |
F17 | 106 | The F17 key. |
F18 | 107 | The F18 key. |
F19 | 108 | The F19 key. |
F20 | 109 | The F20 key. |
F21 | 110 | The F21 key. |
F22 | 111 | The F22 key. |
F23 | 112 | The F23 key. |
F24 | 113 | The F24 key. |
NumLock | 114 | The Num Lock key. |
Scroll | 115 | The Scroll Lock key. |
LeftShift | 116 | The left Shift key. |
RightShift | 117 | The right Shift key. |
LeftCtrl | 118 | The left CTRL key. |
RightCtrl | 119 | The right CTRL key. |
LeftAlt | 120 | The left ALT key. |
RightAlt | 121 | The right ALT key. |
BrowserBack | 122 | The Browser Back key. |
BrowserForward | 123 | The Browser Forward key. |
BrowserRefresh | 124 | The Browser Refresh key. |
BrowserStop | 125 | The Browser Stop key. |
BrowserSearch | 126 | The Browser Search key. |
BrowserFavorites | 127 | The Browser Favorites key. |
BrowserHome | 128 | The Browser Home key. |
VolumeMute | 129 | The Volume Mute key. |
VolumeDown | 130 | The Volume Down key. |
VolumeUp | 131 | The Volume Up key. |
MediaNextTrack | 132 | The Media Next Track key. |
MediaPreviousTrack | 133 | The Media Previous Track key. |
MediaStop | 134 | The Media Stop key. |
MediaPlayPause | 135 | The Media Play Pause key. |
LaunchMail | 136 | The Launch Mail key. |
SelectMedia | 137 | The Select Media key. |
LaunchApplication1 | 138 | The Launch Application1 key. |
LaunchApplication2 | 139 | The Launch Application2 key. |
Oem1 | 140 | The OEM 1 key. |
OemSemicolon | 140 | The OEM Semicolon key. |
OemPlus | 141 | The OEM Addition key. |
OemComma | 142 | The OEM Comma key. |
OemMinus | 143 | The OEM Minus key. |
OemPeriod | 144 | The OEM Period key. |
Oem2 | 145 | The OEM 2 key. |
OemQuestion | 145 | The OEM Question key. |
Oem3 | 146 | The OEM 3 key. |
OemTilde | 146 | The OEM Tilde key. |
AbntC1 | 147 | The ABNT_C1 (Brazilian) key. |
AbntC2 | 148 | The ABNT_C2 (Brazilian) key. |
Oem4 | 149 | The OEM 4 key. |
OemOpenBrackets | 149 | The OEM Open Brackets key. |
Oem5 | 150 | The OEM 5 key. |
OemPipe | 150 | The OEM Pipe key. |
Oem6 | 151 | The OEM 6 key. |
OemCloseBrackets | 151 | The OEM Close Brackets key. |
Oem7 | 152 | The OEM 7 key. |
OemQuotes | 152 | The OEM Quotes key. |
Oem8 | 153 | The OEM 8 key. |
Oem102 | 154 | The OEM 102 key. |
OemBackslash | 154 | The OEM Backslash key. |
ImeProcessed | 155 | A special key masking the real key being processed by an IME. |
System | 156 | A special key masking the real key being processed as a system key. |
DbeAlphanumeric | 157 | The DBE_ALPHANUMERIC key. |
OemAttn | 157 | The OEM ATTN key. |
DbeKatakana | 158 | The DBE_KATAKANA key. |
OemFinish | 158 | The OEM FINISH key. |
DbeHiragana | 159 | The DBE_HIRAGANA key. |
OemCopy | 159 | The OEM COPY key. |
DbeSbcsChar | 160 | The DBE_SBCSCHAR key. |
OemAuto | 160 | The OEM AUTO key. |
DbeDbcsChar | 161 | The DBE_DBCSCHAR key. |
OemEnlw | 161 | The OEM ENLW key. |
DbeRoman | 162 | The DBE_ROMAN key. |
OemBackTab | 162 | The OEM BACKTAB key. |
Attn | 163 | The ATTN key. |
DbeNoRoman | 163 | The DBE_NOROMAN key. |
CrSel | 164 | The CRSEL key. |
DbeEnterWordRegisterMode | 164 | The DBE_ENTERWORDREGISTERMODE key. |
DbeEnterImeConfigureMode | 165 | The DBE_ENTERIMECONFIGMODE key. |
ExSel | 165 | The EXSEL key. |
DbeFlushString | 166 | The DBE_FLUSHSTRING key. |
EraseEof | 166 | The ERASE EOF key. |
DbeCodeInput | 167 | The DBE_CODEINPUT key. |
Play | 167 | The PLAY key. |
DbeNoCodeInput | 168 | The DBE_NOCODEINPUT key. |
Zoom | 168 | The ZOOM key. |
DbeDetermineString | 169 | The DBE_DETERMINESTRING key. |
NoName | 169 | A constant reserved for future use. |
DbeEnterDialogConversionMode | 170 | The DBE_ENTERDLGCONVERSIONMODE key. |
Pa1 | 170 | The PA1 key. |
OemClear | 171 | The OEM Clear key. |
DeadCharProcessed | 172 | The key is used with another key to create a single combined character. |
Remarks
Information pertaining to key input can be obtained in several different ways in WPF. Key-related events, such as KeyDown and KeyUp, provide key state information through the KeyEventArgs object that is passed to the event handler. Key state information can also be obtained through the static methods on the Keyboard class, such as IsKeyUp and GetKeyStates. The Keyboard class reports the current state of the keyboard.