Skip to main content

KeyGestureFormatInfo Class

Definition​

Assembly:Avalonia.Base
Package:Avalonia

Provides platform specific formatting information for the KeyGesture class

public class KeyGestureFormatInfo

Inheritance: object -> KeyGestureFormatInfo

Implements: IFormatProvider

Constructors​

NameDescription
KeyGestureFormatInfoNo summary available.

KeyGestureFormatInfo Constructor​

public KeyGestureFormatInfo(System.Collections.Generic.IReadOnlyDictionary<Avalonia.Input.Key, string> platformKeyOverrides, string meta, string ctrl, string alt, string shift)

Parameters​

platformKeyOverrides System.Collections.Generic.IReadOnlyDictionary<Avalonia.Input.Key, string>

meta string

ctrl string

alt string

shift string

Methods​

NameDescription
FormatKeyChecks the platformKeyOverrides and s_commonKeyOverrides Dictionaries, in order, for the appropriate string to represent the given Key on this platform. NOTE: If platformKeyOverrides is null, this is assumed to be the Invariant and the Dictionaries are not checked. The plain Enum string is returned instead.
GetFormatNo summary available.
GetInstanceGets the most appropriate KeyGestureFormatInfo for the IFormatProvider requested. This will be, in order: 1. The provided IFormatProvider as a KeyGestureFormatInfo 2. The currently registered platform specific KeyGestureFormatInfo, if present. 3. The Invariant otherwise.

FormatKey Method​

Checks the platformKeyOverrides and s_commonKeyOverrides Dictionaries, in order, for the appropriate string to represent the given Key on this platform. NOTE: If platformKeyOverrides is null, this is assumed to be the Invariant and the Dictionaries are not checked. The plain Enum string is returned instead.

public string FormatKey(Avalonia.Input.Key key)

Parameters​

key Avalonia.Input.Key

The Key to format.

Returns​

string

The appropriate platform specific or common override if present, key.ToString() if not or this is the Invariant.

GetFormat Method​

public object GetFormat(Type formatType)

Parameters​

formatType Type

Returns​

object

GetInstance Method​

Gets the most appropriate KeyGestureFormatInfo for the IFormatProvider requested. This will be, in order:

  1. The provided IFormatProvider as a KeyGestureFormatInfo
  2. The currently registered platform specific KeyGestureFormatInfo, if present.
  3. The Invariant otherwise.
public Avalonia.Input.Platform.KeyGestureFormatInfo GetInstance(IFormatProvider formatProvider)

Parameters​

formatProvider IFormatProvider

The IFormatProvider to get a KeyGestureFormatInfo for.

Returns​

Avalonia.Input.Platform.KeyGestureFormatInfo

Properties​

NameDescription
AltThe string used to represent Alt on the appropriate platform. Defaults to "Alt".
CtrlThe string used to represent Ctrl on the appropriate platform. Defaults to "Ctrl".
InvariantThe Invariant format. Only uses strings straight from the appropriate Enums.
MetaThe string used to represent Meta on the appropriate platform. Defaults to "Cmd".
ShiftThe string used to represent Shift on the appropriate platform. Defaults to "Shift".

Alt Property​

The string used to represent Alt on the appropriate platform. Defaults to "Alt".

public string Alt { get; set; }

Ctrl Property​

The string used to represent Ctrl on the appropriate platform. Defaults to "Ctrl".

public string Ctrl { get; set; }

Invariant Property​

The Invariant format. Only uses strings straight from the appropriate Enums.

public Avalonia.Input.Platform.KeyGestureFormatInfo Invariant { get; set; }

Meta Property​

The string used to represent Meta on the appropriate platform. Defaults to "Cmd".

public string Meta { get; set; }

Shift Property​

The string used to represent Shift on the appropriate platform. Defaults to "Shift".

public string Shift { get; set; }