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

属性值

输入绑定的集合。The collection of input bindings.

示例

下面的示例使用单个 KeyBindingWindow上填充此属性。The 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). 其中每个都应具有 CommandGesture 属性集。Each of these is expected to have a Command and Gesture attribute set.

适用于

另请参阅