This documentation is archived and is not being maintained.

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 a hash function for a particular type. (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, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

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