Class KeyGesture
Defines a keyboard input combination.
public sealed class KeyGesture : IEquatable<KeyGesture>, IFormattable
- Inheritance
-
KeyGesture
- Implements
- Inherited Members
Constructors
KeyGesture(Key, KeyModifiers)
public KeyGesture(Key key, KeyModifiers modifiers = KeyModifiers.None)
Parameters
key
Keymodifiers
KeyModifiers
Properties
Key
public Key Key { get; }
Property Value
KeyModifiers
public KeyModifiers KeyModifiers { get; }
Property Value
Methods
Equals(KeyGesture?)
public bool Equals(KeyGesture? other)
Parameters
other
KeyGesture
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
obj
object
Returns
GetHashCode()
public override int GetHashCode()
Returns
Matches(KeyEventArgs?)
public bool Matches(KeyEventArgs? keyEvent)
Parameters
keyEvent
KeyEventArgs
Returns
Parse(string)
public static KeyGesture Parse(string gesture)
Parameters
gesture
string
Returns
ToString()
public override string ToString()
Returns
ToString(string?, IFormatProvider?)
Returns the current KeyGesture as a string formatted according to the format string and appropriate IFormatProvider
public string ToString(string? format, IFormatProvider? formatProvider)
Parameters
format
stringThe format to use.
- null or "" or "g"The Invariant format, uses Enum.ToString() to format Keys.
- "p"Use platform specific formatting as registerd.
formatProvider
IFormatProviderThe IFormatProvider to use. If null, uses the appropriate provider registered in the Avalonia Locator, or Invariant.
Returns
- string
The formatted string.
Exceptions
- FormatException
Thrown if the format string is not null, "", "g", or "p"
Operators
operator ==(KeyGesture?, KeyGesture?)
public static bool operator ==(KeyGesture? left, KeyGesture? right)
Parameters
left
KeyGestureright
KeyGesture
Returns
operator !=(KeyGesture?, KeyGesture?)
public static bool operator !=(KeyGesture? left, KeyGesture? right)
Parameters
left
KeyGestureright
KeyGesture