CommandBinding CommandBinding CommandBinding CommandBinding Class

Definizione

Associa un oggetto RoutedCommand ai gestori eventi che implementano il 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
Ereditarietà
CommandBindingCommandBindingCommandBindingCommandBinding

Commenti

Un CommandBinding oggetto associa un comando PreviewExecuted /aglieventi PreviewCanExecute e che/implementano e determinano lo stato 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.

Quando viene Execute chiamato CanExecute il metodo o RoutedCommand di un oggetto, PreviewExecuted la / Executed o PreviewCanExecute glieventivengonogeneratisullaCanExecute destinazione 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. Se la destinazione del comando ha CommandBinding un oggetto per il comando, vengono chiamati i gestori appropriati.If the command target has a CommandBinding for the command, the appropriate handlers are called. Se la destinazione del comando non dispone di CommandBinding un oggetto per il comando, gli eventi vengono instradati attraverso la struttura ad albero degli elementi CommandBinding fino a quando non viene trovato un elemento con un oggetto.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 oggetto ha un utilizzo limitato ICommand con un oggetto che RoutedCommandnon è un oggetto.A CommandBinding has limited use with an ICommand that is not a RoutedCommand. Questo è dovuto al CommandBinding fatto che un oggetto associa il ExecutedRoutedEventHandler comando a CanExecuteRoutedEventHandler e l'oggetto che Executed ascolta CanExecute gli eventi indirizzati e generati quando il Execute metodo CanExecute e di RoutedCommandvengono chiamati.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.

Costruttori

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

Inizializza una nuova istanza della classe CommandBinding.Initializes a new instance of the CommandBinding class.

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

Inizializza una nuova istanza della classe CommandBinding mediante l'elemento ICommand specificato.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)

Inizializza una nuova istanza della classe CommandBinding mediante i gestori eventi ICommand e Executed specificati.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)

Inizializza una nuova istanza della classe CommandBinding mediante i gestori eventi ICommand, Executed e CanExecute specificati.Initializes a new instance of the CommandBinding class by using the specified ICommand and the specified Executed and CanExecute event handlers.

Proprietà

Command Command Command Command

Ottiene o imposta l'oggetto ICommand associato a CommandBinding.Gets or sets the ICommand associated with this CommandBinding.

Eventi

CanExecute CanExecute CanExecute CanExecute

Si verifica quando il comando associato a CommandBinding avvia un controllo per determinare se è possibile eseguire il comando sulla destinazione.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

Si verifica quando viene eseguito il comando associato a CommandBinding.Occurs when the command associated with this CommandBinding executes.

PreviewCanExecute PreviewCanExecute PreviewCanExecute PreviewCanExecute

Si verifica quando il comando associato a CommandBinding avvia un controllo per determinare se è possibile eseguire il comando sulla destinazione corrente.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

Si verifica quando viene eseguito il comando associato a CommandBinding.Occurs when the command associated with this CommandBinding executes.

Metodi

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

Determina se l'oggetto specificato è uguale all'oggetto corrente.Determines whether the specified object is equal to the current object.

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

Funge da funzione hash predefinita.Serves as the default hash function.

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

Ottiene l'oggetto Type dell'istanza corrente.Gets the Type of the current instance.

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

Crea una copia superficiale dell'oggetto Object corrente.Creates a shallow copy of the current Object.

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

Restituisce una stringa che rappresenta l'oggetto corrente.Returns a string that represents the current object.

(Inherited from Object)

Si applica a

Vedi anche