ModifierKeys ModifierKeys ModifierKeys ModifierKeys Enum

定義

指定一組輔助按鍵 (Modifier Key)。Specifies the set of modifier keys.

此列舉具有 FlagsAttribute 個屬性允許以位元方式合併其成員值。

public enum class ModifierKeys
[System.ComponentModel.TypeConverter(typeof(System.Windows.Input.ModifierKeysConverter))]
[System.Flags]
public enum ModifierKeys
type ModifierKeys = 
Public Enum ModifierKeys
繼承
屬性

欄位

Alt Alt Alt Alt 1

ALT 鍵。The ALT key.

Control Control Control Control 2

CTRL 鍵。The CTRL key.

None None None None 0

未按下任何輔助按鍵。No modifiers are pressed.

Shift Shift Shift Shift 4

SHIFT 鍵。The SHIFT key.

Windows Windows Windows Windows 8

Windows 標幟按鍵。The Windows logo key.

範例

下列範例顯示如何建立KeyBinding KeyGestureRoutedCommand相關聯的。The following example shows how to create a KeyBinding that associates a KeyGesture with a RoutedCommand. KeyBindingModifierKeys使用列舉來指定手勢的輔助按鍵。The KeyBinding uses the ModifierKeys enumeration to specify the modifier key of the gesture.

<Window.InputBindings>
  <KeyBinding Command="ApplicationCommands.Open"
              Gesture="CTRL+R" />
</Window.InputBindings>
// 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屬性是目前所按下的輔助按鍵集合。 KeyboardThe Modifiers property on the Keyboard class is the set of the modifier keys that are currently pressed.

APIAPIs Keyboard Modifiers 的某些KeyBinding會使用列舉,KeyGesture這是、、和MouseGesture類別上的屬性。 ModifierKeys Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF)Some APIAPIs in Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) that make use of the ModifierKeys enumeration are the Modifiers properties on the Keyboard, KeyBinding, KeyGesture, and MouseGesture classes.

XAML Attribute UsageXAML Attribute Usage

<object property="oneOrMoreModifierKeys"/>  

XAML 值XAML Values

oneOrMoreModifierKeysoneOrMoreModifierKeys
ModifierKeys列舉定義的一或多個輔助按鍵 (以 "+" 字元分隔)。One or more modifier keys, defined by the ModifierKeys enumeration, delimited with a "+" character.

適用於

另請參閱