Struct KeyGesture
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
KeyKeysId of the pressed key.
ModifiersModifierKeysAll modifier keys pressed along with
Key.
Properties
Key
Id of the pressed key.
public Keys Key { get; init; }
Property Value
Modifiers
All modifier keys pressed along with Key.
public ModifierKeys Modifiers { get; init; }
Property Value
Methods
Parse(ReadOnlySpan<char>, IFormatProvider?)
Parses a span of characters into a value.
public static KeyGesture Parse(ReadOnlySpan<char> s, IFormatProvider? provider)
Parameters
sReadOnlySpan<char>The span of characters to parse.
providerIFormatProviderAn object that provides culture-specific formatting information about
s.
Returns
- KeyGesture
The result of parsing
s.
Exceptions
- FormatException
sis not in the correct format.- OverflowException
sis not representable by KeyGesture.
Parse(string, IFormatProvider?)
Parses a string into a value.
public static KeyGesture Parse(string s, IFormatProvider? provider)
Parameters
sstringThe string to parse.
providerIFormatProviderAn object that provides culture-specific formatting information about
s.
Returns
- KeyGesture
The result of parsing
s.
Exceptions
- ArgumentNullException
sis null.- FormatException
sis not in the correct format.- OverflowException
sis 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
sReadOnlySpan<char>The span of characters to parse.
providerIFormatProviderAn object that provides culture-specific formatting information about
s.resultKeyGestureWhen this method returns, contains the result of successfully parsing
s, or an undefined value on failure.
Returns
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
sstringThe string to parse.
providerIFormatProviderAn object that provides culture-specific formatting information about
s.resultKeyGestureWhen this method returns, contains the result of successfully parsing
sor an undefined value on failure.