Compartir a través de


Keyboard Class

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

Represents the keyboard device.

Inheritance Hierarchy

System.Object
  System.Windows.Input.Keyboard

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

Syntax

'Declaration
Public NotInheritable Class Keyboard
public static class Keyboard

The Keyboard type exposes the following members.

Properties

  Name Description
Public propertyStatic memberSupported by Silverlight for Windows Phone Modifiers Gets the set of ModifierKeys that are currently pressed.

Top

Remarks

Most scenarios involving the keyboard are addressed by writing handlers for the key events KeyUp and KeyDown. The Keyboard class is a utility class with only one property, Modifiers. The event data class for KeyUp and KeyDown events reports the primary pressed key corresponding to each raising of a key event. If you want to check whether any modifier keys are also in a pressed state, you can check the Keyboard.Modifiers value from within a mouse event handler.

You might also want to check the Keyboard.Modifiers value when handling mouse events, depending on your application's input design.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

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

Platforms

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

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Other Resources