I​Command I​Command I​Command Interface

Definition

Defines the contract for commanding.

.NET This interface appears as System.Windows.Input.ICommand.

public : interface ICommandpublic interface ICommandPublic Interface ICommand
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

When programming with .NET, this interface is hidden and developers should use the System.Windows.Input.ICommand interface.

Note

Older versions of .NET reference documentation (3.0) indicate that the System.Windows.Input.ICommand interface is defined in PresentationCore, which is a Windows Presentation Foundation (WPF) assembly. That is no longer the case, System.Windows.Input.ICommand is defined in the System.ObjectModel assembly, so you don't need to take Windows Presentation Foundation (WPF) dependencies in order to implement ICommand.

Methods

CanExecute(Object) CanExecute(Object) CanExecute(Object)

Defines the method that determines whether the command can execute in its current state.

public : PlatForm::Boolean CanExecute(PlatForm::Object parameter)public bool CanExecute(Object parameter)Public Function CanExecute(parameter As Object) As bool
Parameters
parameter
PlatForm::Object Object Object

Data used by the command. If the command does not require data to be passed, this object can be set to null.

Returns
PlatForm::Boolean bool bool

true if this command can be executed; otherwise, false.

Attributes

Execute(Object) Execute(Object) Execute(Object)

Defines the method to be called when the command is invoked.

public : void Execute(PlatForm::Object parameter)public void Execute(Object parameter)Public Function Execute(parameter As Object) As void
Parameters
parameter
PlatForm::Object Object Object

Data used by the command. If the command does not require data to be passed, can be set to null.

Attributes

Remarks

When programming with .NET, this interface is hidden and developers should use the System.Windows.Input.ICommand interface.

Events

CanExecuteChanged CanExecuteChanged CanExecuteChanged

Occurs when changes occur that affect whether the command should execute.

public : abstract event EventHandler CanExecuteChangedpublic abstract event EventHandler CanExecuteChangedPublic MustInherit Event CanExecuteChanged
Attributes