ICommand.CanExecuteChanged Event

Definition

Occurs whenever something happens that affects whether the command can execute.

// Register
event_token CanExecuteChanged(EventHandler<IInspectable> const& handler) const;

// Revoke with event_token
void CanExecuteChanged(event_token const* cookie) const;

// Revoke with event_revoker
ICommand::CanExecuteChanged_revoker CanExecuteChanged(auto_revoke_t, EventHandler<IInspectable> const& handler) const;
event System.EventHandler<object> CanExecuteChanged;
function onCanExecuteChanged(eventArgs) { /* Your code */ }
iCommand.addEventListener("canexecutechanged", onCanExecuteChanged);
iCommand.removeEventListener("canexecutechanged", onCanExecuteChanged);
- or -
iCommand.oncanexecutechanged = onCanExecuteChanged;
Event CanExecuteChanged As EventHandler(Of Object) 

Event Type

Remarks

Call CanExecute on the command element when this event occurs.

A command element typically disables itself if the command it is associated with cannot execute. For example, a MenuItem associated with the Paste command is disabled when the there is nothing on the clipboard to paste.

Applies to

See also