CommandBinding 类 
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将 RoutedCommand 绑定到实现该命令的事件处理程序。
public ref class CommandBinding
	public class CommandBinding
	type CommandBinding = class
	Public Class CommandBinding
		- 继承
 - 
				CommandBinding
 
注解
将 CommandBinding 命令与 PreviewExecuted/Executed 实现并确定命令状态的 和 PreviewCanExecute/CanExecute 事件相关联。
Execute调用 的 RoutedCommand 或 CanExecute 方法时,PreviewExecuted/Executed将在命令目标上引发 或 PreviewCanExecute/CanExecute 事件。 如果命令目标具有 CommandBinding 命令的 ,则调用相应的处理程序。 如果命令目标没有 CommandBinding 命令的 ,则事件将通过元素树路由,直到找到具有 的 CommandBinding 元素。
与 CommandBinding 不是 的 一 ICommand 起使用 RoutedCommand有限。 这是因为 将 CommandBinding 命令ExecutedRoutedEventHandler绑定到 ,以及 CanExecuteRoutedEventHandler ,后者侦Executed听 在调用 的 和 CanExecute 方法时Execute引发的 RoutedCommand 和 CanExecute 路由事件。
构造函数
| CommandBinding() | 
		 初始化 CommandBinding 类的新实例。  | 
        	
| CommandBinding(ICommand) | 
		 使用指定的 CommandBinding 初始化 ICommand 类的新实例。  | 
        	
| CommandBinding(ICommand, ExecutedRoutedEventHandler) | 
		 使用指定的 CommandBinding 和指定的 ICommand 事件处理程序初始化 Executed 类的新实例。  | 
        	
| CommandBinding(ICommand, ExecutedRoutedEventHandler, CanExecuteRoutedEventHandler) | 
		 使用指定的 CommandBinding 和指定的 ICommand 及 Executed 事件处理程序初始化 CanExecute 类的新实例。  | 
        	
属性
| Command | 
		 获取或设置与此 CommandBinding 关联的 ICommand。  | 
        	
方法
| Equals(Object) | 
		 确定指定对象是否等于当前对象。 (继承自 Object) | 
        	
| GetHashCode() | 
		 作为默认哈希函数。 (继承自 Object) | 
        	
| GetType() | 
		 获取当前实例的 Type。 (继承自 Object) | 
        	
| MemberwiseClone() | 
		 创建当前 Object 的浅表副本。 (继承自 Object) | 
        	
| ToString() | 
		 返回表示当前对象的字符串。 (继承自 Object) | 
        	
事件
| CanExecute | 
		 在与此 CommandBinding 关联的命令开始检查能否对命令目标执行该命令时发生。  | 
        	
| Executed | 
		 执行与此 CommandBinding 相关联的命令时发生。  | 
        	
| PreviewCanExecute | 
		 在与此 CommandBinding 关联的命令开始检查能否对当前命令目标执行该命令时发生。  | 
        	
| PreviewExecuted | 
		 执行与此 CommandBinding 相关联的命令时发生。  |