InputBinding.Gesture プロパティ

定義

この入力バインドに関連付けられる InputGesture を取得または設定します。

public:
 virtual property System::Windows::Input::InputGesture ^ Gesture { System::Windows::Input::InputGesture ^ get(); void set(System::Windows::Input::InputGesture ^ value); };
public virtual System.Windows.Input.InputGesture Gesture { get; [System.Security.SecurityCritical] set; }
public virtual System.Windows.Input.InputGesture Gesture { get; set; }
[<set: System.Security.SecurityCritical>]
member this.Gesture : System.Windows.Input.InputGesture with get, set
member this.Gesture : System.Windows.Input.InputGesture with get, set
Public Overridable Property Gesture As InputGesture

プロパティ値

関連付けられたジェスチャ。 既定値は、null です。

属性

次の例では、 を使用 KeyBinding して を にバインド KeyGesture する方法を RoutedCommand示します。 Alt + L キーを KeyGesture 押すと、 Close コマンドが呼び出されます。

<KeyBinding Modifiers="Alt"
            Key="L"
            Command="ApplicationCommands.Close" />
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)

注釈

入力ジェスチャは、 コマンドを呼び出すアクションです。 WPF の入力ジェスチャの例として、 と MouseGestureがありますKeyGesture。 は KeyGesture 、 と の Key セット ModifierKeysの組み合わせです。 は MouseGesture 、 と の MouseAction セット ModifierKeysの組み合わせです。

クラス自体は InputBinding XAML の使用をサポートしていません。これは、パブリック パラメーターなしのコンストラクターを公開しないためです (パラメーターなしのコンストラクターは存在しますが、保護されています)。 ただし、派生クラスはパブリック コンストラクターを公開できるため、XAML を使用して から InputBinding 継承されるプロパティを設定できます。 XAML でインスタンス化でき、XAML でプロパティを設定できる 2 つの既存InputBindingの派生クラスは と MouseBindingですKeyBinding

XAML 属性の使用方法

<KeyBindingGesture="KeyGesture"/>

または

<MouseBindingGesture="MouseGesture"/>

または

<inputBindingDerivedClassGesture="InputGesture"/>

XAML プロパティ要素の使用

<inputBindingDerivedClass>  
  <inputBindingDerivedClass.Gesture>  
    <inputGestureImplementation/>  
  </inputBindingDerivedClass.Gesture>  
</inputBindingDerivedClass>  

XAML 値

inputBindingDerivedClass
MouseBindingなどのKeyBindingオブジェクト要素構文InputBindingをサポートする の派生クラス。 「解説」を参照してください。

inputGestureImplementation
オブジェクト要素の InputGesture 構文をサポートする のカスタム派生クラス。

適用対象

こちらもご覧ください