Sdílet prostřednictvím


KeyGesture Konstruktory

Definice

Inicializuje novou instanci KeyGesture třídy.

Přetížení

Name Description
KeyGesture(Key)

Inicializuje novou instanci KeyGesture třídy se zadaným Key.

KeyGesture(Key, ModifierKeys)

Inicializuje novou instanci KeyGesture třídy se zadaným Key a ModifierKeys.

KeyGesture(Key, ModifierKeys, String)

Inicializuje novou instanci KeyGesture třídy se zadaným Key, ModifierKeysa zobrazit řetězec.

KeyGesture(Key)

Inicializuje novou instanci KeyGesture třídy se zadaným Key.

public:
 KeyGesture(System::Windows::Input::Key key);
public KeyGesture(System.Windows.Input.Key key);
new System.Windows.Input.KeyGesture : System.Windows.Input.Key -> System.Windows.Input.KeyGesture
Public Sub New (key As Key)

Parametry

key
Key

Klíč přidružený k tomuto gestu.

Výjimky

key není platný Key.

key není platný KeyGesture.

Příklady

Následující příklad ukazuje, jak použít tento konstruktor k vytvoření KeyGesture a přidružení k .KeyBinding Poté KeyBinding se přidá do InputBindingCollection .Window

KeyGesture OpenCmdKeyGesture = new KeyGesture(Key.F12);
KeyBinding OpenKeyBinding = new KeyBinding(
    ApplicationCommands.Open,
    OpenCmdKeyGesture);

this.InputBindings.Add(OpenKeyBinding);
Dim OpenCmdKeyGesture As New KeyGesture(Key.F12)
Dim OpenKeyBinding As New KeyBinding(ApplicationCommands.Open, OpenCmdKeyGesture)

Me.InputBindings.Add(OpenKeyBinding)

Poznámky

Ve většině případů musí být přidružena KeyGesture k jednomu nebo více ModifierKeys. Výjimkou tohoto pravidla jsou funkční klávesy a numerické klávesy klávesnice, které mohou být samy o sobě platné KeyGesture .

Viz také

Platí pro

KeyGesture(Key, ModifierKeys)

Inicializuje novou instanci KeyGesture třídy se zadaným Key a ModifierKeys.

public:
 KeyGesture(System::Windows::Input::Key key, System::Windows::Input::ModifierKeys modifiers);
public KeyGesture(System.Windows.Input.Key key, System.Windows.Input.ModifierKeys modifiers);
new System.Windows.Input.KeyGesture : System.Windows.Input.Key * System.Windows.Input.ModifierKeys -> System.Windows.Input.KeyGesture
Public Sub New (key As Key, modifiers As ModifierKeys)

Parametry

key
Key

Klávesa přidružená k gestu.

modifiers
ModifierKeys

Modifikační klávesy přidružené k gestu.

Výjimky

modifiers není platný. ModifierKeys

nebo

key není platný Key.

key a modifiers neformujte platnou KeyGesture.

Příklady

Následující příklad ukazuje, jak použít tento konstruktor k vytvoření KeyGesture a přidružení k .KeyBinding Poté KeyBinding se přidá do InputBindingCollection .Window

KeyGesture CloseCmdKeyGesture = new KeyGesture(
    Key.L, ModifierKeys.Alt);

KeyBinding CloseKeyBinding = new KeyBinding(
    ApplicationCommands.Close, CloseCmdKeyGesture);

this.InputBindings.Add(CloseKeyBinding);
Dim CloseCmdKeyGesture As New KeyGesture(Key.L, ModifierKeys.Alt)

Dim CloseKeyBinding As New KeyBinding(ApplicationCommands.Close, CloseCmdKeyGesture)

Me.InputBindings.Add(CloseKeyBinding)

Poznámky

Ve většině případů musí být přidružena KeyGesture k jednomu nebo více ModifierKeys. Výjimkou tohoto pravidla jsou funkční klávesy a numerické klávesy klávesnice, které mohou být samy o sobě platné KeyGesture .

Viz také

Platí pro

KeyGesture(Key, ModifierKeys, String)

Inicializuje novou instanci KeyGesture třídy se zadaným Key, ModifierKeysa zobrazit řetězec.

public:
 KeyGesture(System::Windows::Input::Key key, System::Windows::Input::ModifierKeys modifiers, System::String ^ displayString);
public KeyGesture(System.Windows.Input.Key key, System.Windows.Input.ModifierKeys modifiers, string displayString);
new System.Windows.Input.KeyGesture : System.Windows.Input.Key * System.Windows.Input.ModifierKeys * string -> System.Windows.Input.KeyGesture
Public Sub New (key As Key, modifiers As ModifierKeys, displayString As String)

Parametry

key
Key

Klávesa přidružená k gestu.

modifiers
ModifierKeys

Modifikační klávesy přidružené k gestu.

displayString
String

Řetězcová reprezentace KeyGesture.

Výjimky

modifiers není platný. ModifierKeys

nebo

key není platný Key.

displayString je null.

key a modifiers neformujte platnou KeyGesture.

Poznámky

Vlastnost DisplayString je nastavena na displayString parametr.

Viz také

Platí pro