UIElement.InputBindings UIElement.InputBindings UIElement.InputBindings UIElement.InputBindings Property

定义

获取与此元素关联的输入绑定的集合。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.

示例

下面的示例使用Window KeyBinding一个在上填充此属性。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.

适用于

另请参阅