共用方式為


MouseGesture.Modifiers 屬性

定義

取得或設定與這個 MouseGesture 相關聯的輔助按鍵。

public:
 property System::Windows::Input::ModifierKeys Modifiers { System::Windows::Input::ModifierKeys get(); void set(System::Windows::Input::ModifierKeys value); };
public System.Windows.Input.ModifierKeys Modifiers { get; set; }
member this.Modifiers : System.Windows.Input.ModifierKeys with get, set
Public Property Modifiers As ModifierKeys

屬性值

與這個筆勢相關聯的輔助按鍵。 預設值是 None

範例

下列範例示範如何透過 MouseBinding建立 MouseGesture ,並將其與 建立關聯RoutedCommand

MouseGesture OpenCmdMouseGesture = new MouseGesture();
OpenCmdMouseGesture.MouseAction = MouseAction.WheelClick;
OpenCmdMouseGesture.Modifiers = ModifierKeys.Control;

MouseBinding OpenCmdMouseBinding = new MouseBinding();
OpenCmdMouseBinding.Gesture = OpenCmdMouseGesture;
OpenCmdMouseBinding.Command = ApplicationCommands.Open;

this.InputBindings.Add(OpenCmdMouseBinding);
Dim OpenCmdMouseGesture As New MouseGesture()
OpenCmdMouseGesture.MouseAction = MouseAction.WheelClick
OpenCmdMouseGesture.Modifiers = ModifierKeys.Control

Dim OpenCmdMouseBinding As New MouseBinding()
OpenCmdMouseBinding.Gesture = OpenCmdMouseGesture
OpenCmdMouseBinding.Command = ApplicationCommands.Open

Me.InputBindings.Add(OpenCmdMouseBinding)

備註

KeyGesture不同於 ,MouseAction不需要與 ModifierKeys 配對,才能成為有效的 MouseGesture

ModifierKeys 是位欄位欄位列舉,因此可以同時按下多個修飾詞按鍵。 使用位作業來判斷按下的確切修飾詞按鍵集。

XAML Attribute Usage

<object Modifiers="oneOrMoreModifierKeys"/>  

XAML 值

oneOrMoreModifierKeys
列舉所 ModifierKeys 定義的一或多個修飾詞索引鍵,並以 “+” 字元分隔。

適用於

另請參閱