Skip to main content

PlatformKeyInfo Struct

Definition​

Namespace:Avalonia.Input
Assembly:Avalonia.Base
Package:Avalonia

Platform-specific data of a key event, for code that knows the platform, for example terminal emulators that encode keys the way a native terminal does. Each value is null when the platform doesn't provide it.

public struct PlatformKeyInfo

Inheritance: ValueType -> PlatformKeyInfo

Implements: IEquatable<PlatformKeyInfo>

Constructors​

NameDescription
PlatformKeyInfoInitializes a new instance of the Avalonia.Input.PlatformKeyInfo struct.

PlatformKeyInfo Constructor​

Initializes a new instance of the Avalonia.Input.PlatformKeyInfo struct.

public PlatformKeyInfo(string format)

Parameters​

format string

The platform that produced the values, usually one of Avalonia.Input.KnownPlatformKeyInfoFormats.

Methods​

NameDescription
Equals (2 overloads)No summary available.
GetHashCodeNo summary available.
ToStringNo summary available.

Equals overloads​

Equals Method​

public bool Equals(Avalonia.Input.PlatformKeyInfo other)
Parameters​

other Avalonia.Input.PlatformKeyInfo

Returns​

bool

Equals Method​

public bool Equals(object obj)
Parameters​

obj object

Returns​

bool

GetHashCode Method​

public int GetHashCode()

Returns​

int

ToString Method​

public string ToString()

Returns​

string

Properties​

NameDescription
FormatGets the platform that produced the values, usually one of Avalonia.Input.KnownPlatformKeyInfoFormats. It is null only for a default instance.
ModifiersGets the modifier state.
ScanCodeGets the scan code of the key.
VirtualKeyGets the virtual key.

Format Property​

Gets the platform that produced the values, usually one of Avalonia.Input.KnownPlatformKeyInfoFormats. It is null only for a default instance.

public string Format { get; set; }

Modifiers Property​

Gets the modifier state.

public Nullable<ulong> Modifiers { get; set; }

Remarks​

Win32: console dwControlKeyState flags (LEFT_CTRL_PRESSED, RIGHT_ALT_PRESSED, ENHANCED_KEY, ...), including the key being pressed. X11: XKeyEvent.state, the state before the event. Wayland: the effective XKB modifier mask, the state before the event. macOS: NSEventModifierFlags. Only the core XKB modifiers (Shift, Lock, Control, Mod1 to Mod5) have fixed bits. What Mod1 to Mod5 mean depends on the XKB keymap.

ScanCode Property​

Gets the scan code of the key.

public Nullable<uint> ScanCode { get; set; }

Remarks​

Win32: the hardware scan code, plus 0xE000 for extended keys. X11 and Wayland: the XKB keycode (evdev code + 8). macOS: NSEvent.keyCode, which identifies the physical key on every layout. Qt reports it as the native virtual key.

VirtualKey Property​

Gets the virtual key.

public Nullable<uint> VirtualKey { get; set; }

Remarks​

Win32: the virtual-key code. X11 and Wayland: the keysym. macOS: null, because macOS has no layout-dependent key code. See Avalonia.Input.PlatformKeyInfo.ScanCode.