Export (0) Print
Expand All

KeyEventArgs.Key Property

Gets the keyboard key associated with the event.

Namespace:  System.Windows.Input
Assembly:  System.Windows (in System.Windows.dll)

public Key Key { get; }

Property Value

Type: System.Windows.Input.Key
One of the enumeration values that indicates the key referenced by the event.

Key codes have possible platform variations. Keys that are portable will return a discrete key for Key and also a PlatformKeyCode. Keys that are not portable will return Unknown for Key, and also a PlatformKeyCode.

In Silverlight 1.0, you could check for modifier keys by checking the values of the Ctrl and Shift properties of the KeyEventArgs. In Silverlight, you check for modifier keys by calling the static Keyboard.Modifiers property from within your key event handler. The Keyboard.Modifiers property returns a combined enumeration value that reports all possible modifier keys (including the ALT key and platform-specific modifier keys) that are pressed at that time.

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2014 Microsoft