public ref class CommandBinding
public class CommandBinding
type CommandBinding = class
Public Class CommandBinding
一个CommandBinding将与命令相关联PreviewExecuted / Executed并PreviewCanExecute / CanExecute事件的实现，并确定命令的状态。A CommandBinding associates a command with the PreviewExecuted/Executed and PreviewCanExecute/CanExecute events which implement and determine the status of the command.
当Execute或CanExecute方法RoutedCommand调用时， PreviewExecuted / Executed或者PreviewCanExecute / CanExecute命令目标上引发事件。When the Execute or CanExecute method of a RoutedCommand is called, the PreviewExecuted/Executed or the PreviewCanExecute/CanExecute events are raised on the command target. 如果命令目标有CommandBinding命令，调用相应的处理程序。If the command target has a CommandBinding for the command, the appropriate handlers are called. 如果命令目标不具有CommandBinding命令，事件将发送通过元素树具有的元素，直到CommandBinding找到。If the command target does not have a CommandBinding for the command, the events are routed through the element tree until an element that has a CommandBinding is found.
一个CommandBinding有限使用与ICommand不是RoutedCommand。A CommandBinding has limited use with an ICommand that is not a RoutedCommand. 这是因为CommandBinding绑定到命令ExecutedRoutedEventHandler并CanExecuteRoutedEventHandler其侦听Executed并CanExecute路由事件的时引发Execute和CanExecute方法RoutedCommand调用。This is because a CommandBinding binds the command to the ExecutedRoutedEventHandler and the CanExecuteRoutedEventHandler which listen to the Executed and CanExecute routed events which are raised when the Execute and CanExecute method of the RoutedCommand are called.
|Command Command Command Command|
|CanExecute CanExecute CanExecute CanExecute|
|Executed Executed Executed Executed|
|PreviewCanExecute PreviewCanExecute PreviewCanExecute PreviewCanExecute||
在与此 CommandBinding 关联的命令开始检查能否对当前命令目标执行该命令时发生。Occurs when the command associated with this CommandBinding initiates a check to determine whether the command can be executed on the current command target.
|PreviewExecuted PreviewExecuted PreviewExecuted PreviewExecuted|
|Equals(Object) Equals(Object) Equals(Object) Equals(Object)||
确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.(Inherited from Object)
|GetHashCode() GetHashCode() GetHashCode() GetHashCode()||
作为默认哈希函数。Serves as the default hash function.(Inherited from Object)
|GetType() GetType() GetType() GetType()||Object)|
|MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()||Object)|
|ToString() ToString() ToString() ToString()||
返回表示当前对象的字符串。Returns a string that represents the current object.(Inherited from Object)