Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
KeyboardDevice Class
Collapse the table of content
Expand the table of content

KeyboardDevice Class

Abstract class that represents a keyboard device.

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

public abstract class KeyboardDevice : InputDevice

The KeyboardDevice type exposes the following members.

Protected methodKeyboardDeviceInitializes a new instance of the KeyboardDevice class.

Public propertyActiveSourceGets the PresentationSource that is reporting input for this device. (Overrides InputDevice.ActiveSource.)
Public propertyDefaultRestoreFocusModeGets or sets the behavior of Windows Presentation Foundation (WPF) when restoring focus.
Public propertyDispatcherGets the Dispatcher this DispatcherObject is associated with. (Inherited from DispatcherObject.)
Public propertyFocusedElementGets the element that has keyboard focus.
Public propertyModifiersGets the set of ModifierKeys which are currently pressed.
Public propertyTargetGets the specified IInputElement that input from this device is sent to. (Overrides InputDevice.Target.)

Public methodCheckAccessDetermines whether the calling thread has access to this DispatcherObject. (Inherited from DispatcherObject.)
Public methodClearFocusClears focus.
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodFocusSets keyboard focus on the specified IInputElement.
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetKeyStatesGets the set of key states for the specified Key.
Protected methodGetKeyStatesFromSystemWhen overridden in a derived class, obtains the KeyStates for the specified Key.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodIsKeyDownDetermines whether the specified Key is in the down state.
Public methodIsKeyToggledDetermines whether the specified Key is in the toggled state.
Public methodIsKeyUpDetermines whether the specified Key is in the up state.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Public methodVerifyAccessEnforces that the calling thread has access to this DispatcherObject. (Inherited from DispatcherObject.)

The KeyboardDevice supports the Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code.

For keyboard related input, use the Keyboard class. The Keyboard class represents the keyboard to an application and provides methods, properties, and events that reflect the state of the keyboard.

The Keyboard class delegates to the appropriate KeyboardDevice.

Each InputDevice object represents one particular input device. For example, if there are two mice, there will be two InputDevice objects.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

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