CommandBinding CommandBinding CommandBinding CommandBinding Class

Definición

Enlaza un RoutedCommand a los controladores de eventos que implementan el comando.Binds a RoutedCommand to the event handlers that implement the command.

public ref class CommandBinding
public class CommandBinding
type CommandBinding = class
Public Class CommandBinding
Herencia
CommandBindingCommandBindingCommandBindingCommandBinding

Comentarios

Un CommandBinding asocia un comando con los PreviewExecuted /eventosy PreviewCanExecute queimplementan/ y determinan el estado del comando. CanExecute ExecutedA CommandBinding associates a command with the PreviewExecuted/Executed and PreviewCanExecute/CanExecute events which implement and determine the status of the command.

/ Executed PreviewExecuted RoutedCommand CanExecute PreviewCanExecute Cuando se llama al método Execute o de un, se generan los eventosCanExecute o / en el destino del comando.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. Si el destino del comando tiene CommandBinding un para el comando, se llama a los controladores adecuados.If the command target has a CommandBinding for the command, the appropriate handlers are called. Si el destino del comando no tiene un CommandBinding para el comando, los eventos se enrutan a través del árbol de elementos hasta que se CommandBinding encuentra un elemento que tiene un.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.

Un CommandBinding tiene un uso limitado con ICommand un que no es RoutedCommandun.A CommandBinding has limited use with an ICommand that is not a RoutedCommand. CommandBinding Esto se debe ExecutedRoutedEventHandler a que enlaza el comando a y CanExecuteRoutedEventHandler que escuchan los Executed eventos enrutados y CanExecute que se generan cuando el Execute método y CanExecute del RoutedCommandse llama a.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.

Constructores

CommandBinding() CommandBinding() CommandBinding() CommandBinding()

Inicializa una nueva instancia de la clase CommandBinding.Initializes a new instance of the CommandBinding class.

CommandBinding(ICommand) CommandBinding(ICommand) CommandBinding(ICommand) CommandBinding(ICommand)

Inicializa una nueva instancia de la clase CommandBinding utilizando el objeto ICommand especificado.Initializes a new instance of the CommandBinding class by using the specified ICommand.

CommandBinding(ICommand, ExecutedRoutedEventHandler) CommandBinding(ICommand, ExecutedRoutedEventHandler) CommandBinding(ICommand, ExecutedRoutedEventHandler) CommandBinding(ICommand, ExecutedRoutedEventHandler)

Inicializa una nueva instancia de la clase CommandBinding mediante la interfaz ICommand y el controlador de eventos Executed especificado.Initializes a new instance of the CommandBinding class by using the specified ICommand and the specified Executed event handler.

CommandBinding(ICommand, ExecutedRoutedEventHandler, CanExecuteRoutedEventHandler) CommandBinding(ICommand, ExecutedRoutedEventHandler, CanExecuteRoutedEventHandler) CommandBinding(ICommand, ExecutedRoutedEventHandler, CanExecuteRoutedEventHandler) CommandBinding(ICommand, ExecutedRoutedEventHandler, CanExecuteRoutedEventHandler)

Inicializa una nueva instancia de la clase CommandBinding mediante la interfaz ICommand especificada y los controladores de eventos Executed y CanExecute especificados.Initializes a new instance of the CommandBinding class by using the specified ICommand and the specified Executed and CanExecute event handlers.

Propiedades

Command Command Command Command

Obtiene o establece el objeto ICommand asociado a este objeto CommandBinding.Gets or sets the ICommand associated with this CommandBinding.

Eventos

CanExecute CanExecute CanExecute CanExecute

Se produce cuando el comando asociado a este CommandBinding inicia una comprobación para determinar si el comando se puede ejecutar en el destino del comando.Occurs when the command associated with this CommandBinding initiates a check to determine whether the command can be executed on the command target.

Executed Executed Executed Executed

Se produce cuando se ejecuta el comando asociado a este CommandBinding.Occurs when the command associated with this CommandBinding executes.

PreviewCanExecute PreviewCanExecute PreviewCanExecute PreviewCanExecute

Se produce cuando el comando asociado a este CommandBinding inicia una comprobación para determinar si el comando se puede ejecutar en el destino del comando actual.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

Se produce cuando se ejecuta el comando asociado a este CommandBinding.Occurs when the command associated with this CommandBinding executes.

Métodos

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determina si el objeto especificado es igual al objeto actual.Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Sirve como la función hash predeterminada.Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Obtiene el Type de la instancia actual.Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Crea una copia superficial del objeto Object actual.Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

Devuelve una cadena que representa el objeto actual.Returns a string that represents the current object.

(Inherited from Object)

Se aplica a

Consulte también: