Share via


KeyGesture Konstruktory

Definice

Inicializuje novou instanci KeyGesture třídy .

Přetížení

KeyGesture(Key)

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

KeyGesture(Key, ModifierKeys)

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

KeyGesture(Key, ModifierKeys, String)

Inicializuje novou instanci KeyGesture třídy se zadaným Keyzobrazovaným řetězcem , ModifierKeysa .

KeyGesture(Key)

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

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 pomocí tohoto konstruktoru KeyGesture vytvořit a přidružit ho k KeyBinding. Potom 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 z tohoto pravidla jsou funkční klávesy a klávesy na numerické klávesnici, které mohou být samy o sobě platné KeyGesture .

Viz také

Platí pro

KeyGesture(Key, ModifierKeys)

Inicializuje novou instanci KeyGesture třídy se zadanými 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 netvoří platnou KeyGesture.

Příklady

Následující příklad ukazuje, jak pomocí tohoto konstruktoru KeyGesture vytvořit a přidružit ho k KeyBinding. Potom 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 z tohoto pravidla jsou funkční klávesy a klávesy na numerické klávesnici, 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 Keyzobrazovaným řetězcem , ModifierKeysa .

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é vyjádření .KeyGesture

Výjimky

modifiers není platný. ModifierKeys

-nebo-

key není platný Key.

displayString je null.

key a modifiers netvoří platnou KeyGesture.

Poznámky

Vlastnost DisplayString je nastavena displayString na parametr .

Viz také

Platí pro