Table of Contents

Struct KeyGesture

Namespace
Icy.Input.Devices
Assembly
IcyUI.dll

Represents a key combination for commands handling.

public readonly record struct KeyGesture : ISpanParsable<KeyGesture>, IParsable<KeyGesture>, IEquatable<KeyGesture>
Implements
Inherited Members
Extension Methods

Constructors

KeyGesture(Keys, ModifierKeys)

Represents a key combination for commands handling.

public KeyGesture(Keys Key, ModifierKeys Modifiers = ModifierKeys.None)

Parameters

Key Keys

Id of the pressed key.

Modifiers ModifierKeys

All modifier keys pressed along with Key.

Properties

Key

Id of the pressed key.

public Keys Key { get; init; }

Property Value

Keys

Modifiers

All modifier keys pressed along with Key.

public ModifierKeys Modifiers { get; init; }

Property Value

ModifierKeys

Methods

Parse(ReadOnlySpan<char>, IFormatProvider?)

Parses a span of characters into a value.

public static KeyGesture Parse(ReadOnlySpan<char> s, IFormatProvider? provider)

Parameters

s ReadOnlySpan<char>

The span of characters to parse.

provider IFormatProvider

An object that provides culture-specific formatting information about s.

Returns

KeyGesture

The result of parsing s.

Exceptions

FormatException

s is not in the correct format.

OverflowException

s is not representable by KeyGesture.

Parse(string, IFormatProvider?)

Parses a string into a value.

public static KeyGesture Parse(string s, IFormatProvider? provider)

Parameters

s string

The string to parse.

provider IFormatProvider

An object that provides culture-specific formatting information about s.

Returns

KeyGesture

The result of parsing s.

Exceptions

ArgumentNullException

s is null.

FormatException

s is not in the correct format.

OverflowException

s is not representable by KeyGesture.

TryParse(ReadOnlySpan<char>, IFormatProvider?, out KeyGesture)

Tries to parse a span of characters into a value.

public static bool TryParse(ReadOnlySpan<char> s, IFormatProvider? provider, out KeyGesture result)

Parameters

s ReadOnlySpan<char>

The span of characters to parse.

provider IFormatProvider

An object that provides culture-specific formatting information about s.

result KeyGesture

When this method returns, contains the result of successfully parsing s, or an undefined value on failure.

Returns

bool

true if s was successfully parsed; otherwise, false.

TryParse(string?, IFormatProvider?, out KeyGesture)

Tries to parse a string into a value.

public static bool TryParse(string? s, IFormatProvider? provider, out KeyGesture result)

Parameters

s string

The string to parse.

provider IFormatProvider

An object that provides culture-specific formatting information about s.

result KeyGesture

When this method returns, contains the result of successfully parsing s or an undefined value on failure.

Returns

bool

true if s was successfully parsed; otherwise, false.