KeyEventArgs.DeviceId KeyEventArgs.DeviceId KeyEventArgs.DeviceId KeyEventArgs.DeviceId Property


Gets a unique ID for the input device that generated this key event.

Use DeviceId to differentiate between devices that can generate key events, such as multiple Xbox controllers.

DeviceId is not supported for all input devices.

public : Platform::String DeviceId { get; }
winrt::hstring DeviceId();
public string DeviceId { get; }
Public ReadOnly Property DeviceId As string

Property Value

string string

A unique identifier for the input device associated with the key event, or an empty string. The same device can be assigned a different ID each time it is connected.

Additional features and requirements

Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)


This property is useful for retrieving info for a specific user account associated with the input device.

See also