KeyBinding.Modifiers 屬性

定義

取得或設定與這個 ModifierKeys 關聯 KeyGestureKeyBindingGets or sets the ModifierKeys of the KeyGesture associated with this KeyBinding.

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

屬性值

KeyGesture 的輔助按鍵。The modifier keys of the KeyGesture. 預設值是 NoneThe default value is None.

備註

除了函式索引鍵和數位鍵台按鍵以外,KeyGesture 必須包含 Key 以及一或多個 ModifierKeysWith the exception of the function keys and the numeric keypad keys, a KeyGesture must contain a Key and one or more ModifierKeys.

在中定義 KeyBindingExtensible Application Markup Language (XAML)Extensible Application Markup Language (XAML) 有兩種方式可指定 KeyGestureWhen defining a KeyBinding in Extensible Application Markup Language (XAML)Extensible Application Markup Language (XAML) there are two ways to specify the KeyGesture. XAMLXAML 中建立 KeyBinding 的第一種方式是定義 KeyBinding 元素的 Gesture 屬性,這可讓語法將索引鍵和修飾詞指定為單一字串,例如 "CTRL + P"。The first way to establish a KeyBinding in XAMLXAML is to define the Gesture attribute of the KeyBinding element, which enables a syntax to specify keys and modifiers as a single string, for example "CTRL+P". 第二種方式是定義 Key 屬性和 KeyBinding 元素的 Modifiers 屬性。The second way is to define the Key attribute and the Modifiers attributes of the KeyBinding element. 這兩種設定 KeyGesture 的方式都是相同的,而且會修改相同的基礎物件,但如果兩者都使用,則會發生衝突。Both ways of setting the KeyGesture are equivalent and modify the same underlying object, but there will be a conflict if both are used. KeyModifiersGesture 屬性全都設定的情況下,最後定義的屬性將用於 KeyGestureIn the case when the Key, Modifiers, and the Gesture attributes are all set, the attribute which is defined last will be used for the KeyGesture. 您可能有一些情況,例如,Key 設定 [最後] 只會覆寫先前手勢的主要元件,但會將手勢的修飾詞保持不變。You can potentially have situations where for example a Key set last will overwrite just the Key component of a preceding Gesture but leave the Gesture's modifiers the same. 一般來說,建議您只使用 XAMLXAMLGesture 屬性。這可避免發生不明確的情況,提供最有效率的語法,並提供最直接的序列化標記法。In general, it is recommended that you use only the Gesture attribute from XAMLXAML; this will avoid ambiguity, provides the most streamlined syntax, and provides the most straightforward representation for serialization.

XAML Attribute UsageXAML Attribute Usage

<object Modifiers="oneOrMoreModifierKeys"/>  
  

XAML 值XAML Values

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

適用於

另請參閱