Windows Dev Center

KeyRoutedEventArgs.Key property

Gets the input button associated with the event.

Depending on the input device, this can be a mapped value. For raw, unmapped event data, see the OriginalKey property.

Syntax


public VirtualKey Key { get; }

Property value

Type: VirtualKey

A system value that indicates the code for the key referenced by the event.

Remarks

Button input is mapped to differerent key values for various devices, including gamepad and the Xbox One infrared remote.

This table provides the mapping detail for these devices.

ButtonKey value OriginalKey value
GamepadA buttonSpaceGamepadA or NavigationAccept
GamepadB buttonEscapeGamepadB or NavigationCancel
GamepadX buttonGamepadXGamepadX
GamepadY buttonGamepadYGamepadY
GamepadDPad button50GamepadDPadUp/Down/Left/RightGamepadDPadUp/Down/Left/Right or NavigationUp/Down/Left/Right
GamePad Joystick/ThumbstickGamepadLeftThumbstickButton/Up/Down/Left/Right or GamepadRightThumbstickButton/Up/Down/Left/RightGamepadLeftThumbstickButton/Up/Down/Left/Right or GamepadRightThumbstickButton/Up/Down/Left/Right or NavigationUp/Down/Left/Right
Gamepad TriggerGamePadRightTrigger/LeftTriggerGamePadRightTrigger/LeftTrigger
Gamepad Bumper/ShoulderGamePadRightShoulder/LeftShoulderGamePadRightShoulder/LeftShoulder
Gamepad Menu buttonGamepadMenuGamepadMenu or NavigationMenu
Gamepad View buttonGamepadViewGamepadView or NavigationView

 

Requirements (device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.UI.Xaml.Input
Windows::UI::Xaml::Input [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (operating system)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml.Input
Windows::UI::Xaml::Input [C++]

Metadata

Windows.winmd

See also

KeyRoutedEventArgs

 

 

Show:
© 2015 Microsoft