KeyGesture コンストラクター

定義

KeyGesture クラスの新しいインスタンスを初期化します。

オーバーロード

KeyGesture(Key)

KeyGesture を指定して、Key クラスの新しいインスタンスを初期化します。

KeyGesture(Key, ModifierKeys)

指定された KeyGestureKey を使用して、ModifierKeys クラスの新しいインスタンスを初期化します。

KeyGesture(Key, ModifierKeys, String)

KeyGestureKey、および表示文字列を指定して、ModifierKeys クラスの新しいインスタンスを初期化します。

KeyGesture(Key)

KeyGesture を指定して、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)

パラメーター

key
Key

このジェスチャに関連付けられるキー。

例外

key は有効な Key ではありません。

key は有効な KeyGesture ではありません。

次の例では、このコンストラクターを使用して を作成 KeyGesture し、 に関連付ける方法を KeyBinding示します。 KeyBinding次に、 が の WindowInputBindingCollection追加されます。

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)

注釈

ほとんどの場合、 は KeyGesture 1 つ以上 ModifierKeysに関連付けられている必要があります。 この規則の例外は、ファンクション キーとテンキー キーであり、それ自体で有効 KeyGesture にすることができます。

こちらもご覧ください

適用対象

KeyGesture(Key, ModifierKeys)

指定された KeyGestureKey を使用して、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)

パラメーター

key
Key

ジェスチャに関連付けられているキー。

modifiers
ModifierKeys

ジェスチャに関連付けられている変換キー。

例外

modifiers は有効な ModifierKeys ではありません。

- または -

key は有効な Key ではありません。

keymodifiers では、有効な KeyGesture になりません。

次の例では、このコンストラクターを使用して を作成 KeyGesture し、 に関連付ける方法を KeyBinding示します。 KeyBinding次に、 が の WindowInputBindingCollection追加されます。

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)

注釈

ほとんどの場合、 は KeyGesture 1 つ以上 ModifierKeysに関連付けられている必要があります。 この規則の例外は、ファンクション キーとテンキー キーであり、それ自体で有効 KeyGesture にすることができます。

こちらもご覧ください

適用対象

KeyGesture(Key, ModifierKeys, String)

KeyGestureKey、および表示文字列を指定して、ModifierKeys クラスの新しいインスタンスを初期化します。

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)

パラメーター

key
Key

ジェスチャに関連付けられているキー。

modifiers
ModifierKeys

ジェスチャに関連付けられている変換キー。

displayString
String

KeyGesture の文字列形式。

例外

modifiers は有効な ModifierKeys ではありません。

- または -

key は有効な Key ではありません。

displayStringnullです。

keymodifiers では、有効な KeyGesture になりません。

注釈

プロパティは DisplayString パラメーターに displayString 設定されます。

こちらもご覧ください

適用対象