KeyGesture Konstruktory

Definicja

Inicjuje nowe wystąpienie klasy KeyGesture.

Przeciążenia

KeyGesture(Key)

Inicjuje KeyGesture nowe wystąpienie klasy z określonym Keyelementem .

KeyGesture(Key, ModifierKeys)

Inicjuje KeyGesture nowe wystąpienie klasy z określonymi Key parametrami i ModifierKeys.

KeyGesture(Key, ModifierKeys, String)

Inicjuje KeyGesture nowe wystąpienie klasy z określonym Keyciągiem , ModifierKeysi wyświetlanym.

KeyGesture(Key)

Inicjuje KeyGesture nowe wystąpienie klasy z określonym Keyelementem .

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

Klucz skojarzony z tym gestem.

Wyjątki

key element nie jest prawidłowym Keyelementem .

key element nie jest prawidłowym KeyGestureelementem .

Przykłady

W poniższym przykładzie pokazano, jak za pomocą tego konstruktora KeyGesture utworzyć element i skojarzyć go z elementem KeyBinding. Element KeyBinding jest następnie dodawany do InputBindingCollection obiektu typu 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)

Uwagi

W większości przypadków element musi być skojarzony z co najmniej jednym ModifierKeyselementem KeyGesture . Wyjątki od tej reguły to klucze funkcji i klucze klawiatury liczbowej, które mogą być prawidłowe KeyGesture samodzielnie.

Zobacz też

Dotyczy

KeyGesture(Key, ModifierKeys)

Inicjuje KeyGesture nowe wystąpienie klasy z określonymi Key parametrami i 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

Klucz skojarzony z gestem.

modifiers
ModifierKeys

Klawisze modyfikujące skojarzone z gestem.

Wyjątki

modifiers jest nieprawidłowy ModifierKeys

-lub-

key element nie jest prawidłowym Keyelementem .

key i modifiers nie tworzą prawidłowego KeyGesture.

Przykłady

W poniższym przykładzie pokazano, jak za pomocą tego konstruktora KeyGesture utworzyć element i skojarzyć go z elementem KeyBinding. Element KeyBinding jest następnie dodawany do InputBindingCollection obiektu typu 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)

Uwagi

W większości przypadków element musi być skojarzony z co najmniej jednym ModifierKeyselementem KeyGesture . Wyjątki od tej reguły to klucze funkcji i klucze klawiatury liczbowej, które mogą być prawidłowe KeyGesture samodzielnie.

Zobacz też

Dotyczy

KeyGesture(Key, ModifierKeys, String)

Inicjuje KeyGesture nowe wystąpienie klasy z określonym Keyciągiem , ModifierKeysi wyświetlanym.

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

Klucz skojarzony z gestem.

modifiers
ModifierKeys

Klawisze modyfikujące skojarzone z gestem.

displayString
String

Reprezentacja ciągu elementu KeyGesture.

Wyjątki

modifiers jest nieprawidłowy ModifierKeys

-lub-

key element nie jest prawidłowym Keyelementem .

displayString to null.

key i modifiers nie tworzą prawidłowego KeyGesture.

Uwagi

Właściwość DisplayString jest ustawiona na displayString parametr .

Zobacz też

Dotyczy