MouseBinding.Gesture プロパティ

定義

この MouseBinding に関連付けられているジェスチャを取得または設定します。Gets or sets the gesture associated with this MouseBinding.

public:
 virtual property System::Windows::Input::InputGesture ^ Gesture { System::Windows::Input::InputGesture ^ get(); void set(System::Windows::Input::InputGesture ^ value); };
[System.ComponentModel.TypeConverter(typeof(System.Windows.Input.MouseGestureConverter))]
public override System.Windows.Input.InputGesture Gesture { get; set; }
member this.Gesture : System.Windows.Input.InputGesture with get, set
Public Overrides Property Gesture As InputGesture

プロパティ値

ジェスチャ。The gesture.

属性

例外

Gesturenull に設定されます。Gesture is set to null.

次の例は、との間MouseGesture RoutedCommandのバインディングを作成する方法を示しています。The following example show how to create a binding between a MouseGesture to a RoutedCommand.

<MouseBinding Gesture="Alt+MiddleClick"
              Command="ApplicationCommands.New" />
MouseGesture NewCmdMouseGesture = new MouseGesture();
NewCmdMouseGesture.Modifiers = ModifierKeys.Alt;
NewCmdMouseGesture.MouseAction = MouseAction.MiddleClick;

MouseBinding NewMouseBinding = new MouseBinding();
NewMouseBinding.Command = ApplicationCommands.New;
NewMouseBinding.Gesture = NewCmdMouseGesture;

// RootWindow is an instance of Window. 
RootWindow.InputBindings.Add(NewMouseBinding);
Dim NewCmdMouseGesture As New MouseGesture()
NewCmdMouseGesture.Modifiers = ModifierKeys.Alt
NewCmdMouseGesture.MouseAction = MouseAction.MiddleClick

Dim NewMouseBinding As New MouseBinding()
NewMouseBinding.Command = ApplicationCommands.[New]
NewMouseBinding.Gesture = NewCmdMouseGesture

' RootWindow is an instance of Window. 
RootWindow.InputBindings.Add(NewMouseBinding)

注釈

は、のModifierKeysセットの有無に関係なくです。MouseAction MouseGestureA MouseGesture is a MouseAction with or without a set of ModifierKeys. KeyGestureとは異なり、には、修飾子キーが関連付けられている必要MouseGestureはありません。Unlike a KeyGesture, a MouseGesture does not need to have a modifier key associated with it.

適用対象

こちらもご覧ください