CommandBinding Classe

Definição

Associa um RoutedCommand aos manipuladores de eventos que implementam o 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
Herança
CommandBinding

Comentários

Um CommandBinding associa um comando com os PreviewExecuted / Executed PreviewCanExecute / CanExecute eventos e que implementam e determinam o status do comando.A CommandBinding associates a command with the PreviewExecuted/Executed and PreviewCanExecute/CanExecute events which implement and determine the status of the command.

Quando o Execute CanExecute método ou de a RoutedCommand é chamado, o PreviewExecuted / Executed ou os PreviewCanExecute / CanExecute eventos são gerados no destino do 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. Se o destino de comando tiver um CommandBinding para o comando, os manipuladores apropriados serão chamados.If the command target has a CommandBinding for the command, the appropriate handlers are called. Se o destino de comando não tiver um CommandBinding para o comando, os eventos serão roteados pela árvore de elementos até que um elemento com um CommandBinding seja encontrado.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.

Um CommandBinding tem uso limitado com um ICommand que não é um RoutedCommand .A CommandBinding has limited use with an ICommand that is not a RoutedCommand. Isso ocorre porque um CommandBinding associa o comando ao ExecutedRoutedEventHandler e o CanExecuteRoutedEventHandler que ouve os Executed CanExecute eventos roteados e que são gerados quando o Execute CanExecute método e do RoutedCommand é chamado.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.

Construtores

CommandBinding()

Inicializa uma nova instância da classe CommandBinding.Initializes a new instance of the CommandBinding class.

CommandBinding(ICommand)

Inicializa uma nova instância da classe CommandBinding usando o ICommand especificado.Initializes a new instance of the CommandBinding class by using the specified ICommand.

CommandBinding(ICommand, ExecutedRoutedEventHandler)

Inicializa uma nova instância da classe CommandBinding usando o ICommand e o manipulador de eventos Executed especificados.Initializes a new instance of the CommandBinding class by using the specified ICommand and the specified Executed event handler.

CommandBinding(ICommand, ExecutedRoutedEventHandler, CanExecuteRoutedEventHandler)

Inicializa uma nova instância da classe CommandBinding usando o ICommand especificado e os manipuladores de eventos Executed e CanExecute especificados.Initializes a new instance of the CommandBinding class by using the specified ICommand and the specified Executed and CanExecute event handlers.

Propriedades

Command

Obtém ou define o ICommand associado a esse CommandBinding.Gets or sets the ICommand associated with this CommandBinding.

Métodos

Equals(Object)

Determina se o objeto especificado é igual ao objeto atual.Determines whether the specified object is equal to the current object.

(Herdado de Object)
GetHashCode()

Serve como a função de hash padrão.Serves as the default hash function.

(Herdado de Object)
GetType()

Obtém o Type da instância atual.Gets the Type of the current instance.

(Herdado de Object)
MemberwiseClone()

Cria uma cópia superficial do Object atual.Creates a shallow copy of the current Object.

(Herdado de Object)
ToString()

Retorna uma cadeia de caracteres que representa o objeto atual.Returns a string that represents the current object.

(Herdado de Object)

Eventos

CanExecute

Ocorre quando o comando associado a essa CommandBinding inicia uma verificação para determinar se o comando pode ser executado no destino do 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

Ocorre quando o comando associado a este CommandBinding é executado.Occurs when the command associated with this CommandBinding executes.

PreviewCanExecute

Ocorre quando o comando associado a essa CommandBinding inicia uma verificação para determinar se o comando pode ser executado no destino do comando atual.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

Ocorre quando o comando associado a este CommandBinding é executado.Occurs when the command associated with this CommandBinding executes.

Aplica-se a

Veja também