ModifierKeys 列舉
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
指定一組輔助按鍵 (Modifier Key)。
此列舉支援其成員值的位元組合。
public enum class ModifierKeys
C#
[System.ComponentModel.TypeConverter(typeof(System.Windows.Input.ModifierKeysConverter))]
[System.Flags]
public enum ModifierKeys
[<System.ComponentModel.TypeConverter(typeof(System.Windows.Input.ModifierKeysConverter))>]
[<System.Flags>]
type ModifierKeys =
Public Enum ModifierKeys
- 繼承
- 屬性
名稱 | 值 | Description |
---|---|---|
Alt | 1 | ALT 鍵。 |
Control | 2 | CTRL 鍵。 |
None | 0 | 未按下任何輔助按鍵。 |
Shift | 4 | SHIFT 鍵。 |
Windows | 8 | Windows 標幟按鍵。 |
下列範例示範如何建立 與 KeyBinding 建立關聯的 KeyGestureRoutedCommand。 會 KeyBinding 使用 ModifierKeys 列舉來指定手勢的修飾詞索引鍵。
XAML
<Window.InputBindings>
<KeyBinding Command="ApplicationCommands.Open"
Gesture="CTRL+R" />
</Window.InputBindings>
C#
// Creating a KeyBinding between the Open command and Ctrl-R
KeyBinding OpenCmdKeyBinding = new KeyBinding(
ApplicationCommands.Open,
Key.R,
ModifierKeys.Control);
this.InputBindings.Add(OpenCmdKeyBinding);
' Creating a KeyBinding between the Open command and Ctrl-R
Dim OpenCmdKeyBinding As New KeyBinding(ApplicationCommands.Open, Key.R, ModifierKeys.Control)
Me.InputBindings.Add(OpenCmdKeyBinding)
類別 Modifiers 上的 Keyboard 屬性是目前按下的修飾詞按鍵集。
Windows Presentation Foundation (WPF 中的某些 API) 使用 ModifierKeys 列舉是 Modifiers 、 KeyBindingKeyGesture和 MouseGesture 類別上的Keyboard屬性。
<object property="oneOrMoreModifierKeys"/>
oneOrMoreModifierKeys
列舉所 ModifierKeys 定義的一或多個修飾詞索引鍵,並以 “+” 字元分隔。
產品 | 版本 |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |