Udostępnij za pośrednictwem


Key Enumeration

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Specifies the portable key code that is not specific to an operating system.

No XAML usages
value = "EnumerationValue"

Enumeration Values

Key

Decimal value

Hexadecimal value

KEYNONE

0

0

BACKSPACE

1

1

TAB

2

2

ENTER

3

3

SHIFT

4

4

CTRL

5

5

ALT

6

6

CAPSLOCK

7

7

ESCAPE

8

8

SPACE

9

9

PAGEUP

10

A

PAGEDOWN

11

B

END

12

C

HOME

13

D

LEFT

14

E

UP

15

F

RIGHT

16

10

DOWN

17

11

INSERT

18

12

DELETE

19

13

DIGIT0

20

14

DIGIT1

21

15

DIGIT2

22

16

DIGIT3

23

17

DIGIT4

24

18

DIGIT5

25

19

DIGIT6

26

1A

DIGIT7

27

1B

DIGIT8

28

1C

DIGIT9

29

1D

A

30

1E

B

31

1F

C

32

20

D

33

21

E

34

22

F

35

23

G

36

24

H

37

25

I

38

26

J

39

27

K

40

28

L

41

29

M

42

2A

N

43

2B

O

44

2C

P

45

2D

Q

46

2E

R

47

2F

S

48

30

T

49

31

U

50

32

V

51

33

W

52

34

X

53

35

Y

54

36

Z

55

37

F1

56

38

F2

57

39

F3

58

3A

F4

59

3B

F5

60

3C

F6

61

3D

F7

62

3E

F8

63

3F

F9

64

40

F10

65

41

F11

66

42

F12

67

43

NUMPAD0

68

44

NUMPAD1

69

45

NUMPAD2

70

46

NUMPAD3

71

47

NUMPAD4

72

48

NUMPAD5

73

49

NUMPAD6

74

4A

NUMPAD7

75

4B

NUMPAD8

76

4C

NUMPAD9

77

4D

MULTIPLY

78

4E

ADD

79

4F

SUBTRACT

80

50

DECIMAL

81

51

DIVIDE

82

52

KEYUNKNOWN

255

FF

Managed Equivalent

Key

Remarks

The keyEventArgs parameter of the KeyDown and KeyUp events provides both a Key value and a PlatformKeyCode value:

  • Key: A portable key code that is not operating system-specific.

  • PlatformKeyCode: A non-portable key code that is operating system-specific.

The portable key codes are a common subset of all the possible key codes of the supported operating systems, in this case, Macintosh and Windows. For example, the keystroke 'v' is represented as a Key value of 51, and a PlatformKeyCode value of 86. Certain keystrokes, however, are not portable, such as the Windows SCROLL LOCK key. In this case, the Key value is 255, which is the value for an unknown key, and the PlatformKeyCode is 145 on a Windows platform. For information about Windows-specific key codes, see Virtual-Key Codes. For information on Macintosh-specific key codes, see the Apple Developer Connection, Keyboard Layout Services Reference.

Applies To

Key

PlatformKeyCode

See Also

Reference