UIElement.InputBindings 屬性

定義

取得與此元素關聯的輸入繫結集合。Gets the collection of input bindings associated with this element.

public:
 property System::Windows::Input::InputBindingCollection ^ InputBindings { System::Windows::Input::InputBindingCollection ^ get(); };
public System.Windows.Input.InputBindingCollection InputBindings { get; }
member this.InputBindings : System.Windows.Input.InputBindingCollection
Public ReadOnly Property InputBindings As InputBindingCollection

屬性值

InputBindingCollection

輸入繫結的集合。The collection of input bindings.

範例

下列範例會以單一的方式在上填入這個屬性 Window KeyBindingThe following example populates this property on a Window, with a single KeyBinding.

<Window.InputBindings>
  <KeyBinding Key="B"
              Modifiers="Control" 
              Command="ApplicationCommands.Open" />
</Window.InputBindings>

如需集合語法的詳細資訊 XAMLXAML ,請參閱 XAML 語法的詳細資訊。For more information about the XAMLXAML syntax for collections, see XAML Syntax In Detail.

備註

輸入系結支援將命令系結至輸入裝置。Input bindings support the binding of commands to input devices. 例如, MouseBinding 會實作為輸入系結,其中包含對滑鼠裝置的特殊屬性。For example, MouseBinding implements input bindings that include properties that are particular to mouse devices.

輸入系結的集合將包含與型別相關的輸入系結,以及在實例上宣告的輸入系結。The collection of input bindings will include both input bindings that pertain to the type as well as input bindings that are declared on the instance.

相關的屬性( CommandBindings )會維護命令系結的集合。A related property, CommandBindings, maintains a collection of command bindings. 這些與輸入系結不同之處在于,它們代表命令處理的下一個層級,這些動作系結至已知的命令。These differ from input bindings in that they represent the next level down of command processing - actions that are tied to known commands.

XAML 屬性項目用法XAML Property Element Usage

<object>  
  <object.InputBindings>  
    oneOrMoreInputBindings  
  </object.InputBindings>  
</object>  

XAML 值XAML Values

oneOrMoreInputBindingsoneOrMoreInputBindings
一或多個 InputBinding 元素 (通常是 KeyBindingMouseBinding 衍生類別) 。One or more InputBinding elements (typically the KeyBinding or MouseBinding derived classes). 每一個都應該 Command Gesture 設定和屬性。Each of these is expected to have a Command and Gesture attribute set.

適用於

另請參閱