Windows Dev Center

ICommand interface

Defines the contract for commanding.

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

Syntax


public interface class ICommand

Attributes

[Version(0x06020000)]
[WebHostHidden()]

Members

The ICommand interface inherits from the IUnknown interface. ICommand also has these types of members:

Events

The ICommand interface has these events.

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

 

Methods

The ICommand interface has these methods. It also inherits methods from the Object class.

MethodDescription
CanExecute Defines the method that determines whether the command can execute in its current state.
Execute Defines the method to be called when the command is invoked.

 

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 WPF dependencies in order to implement ICommand.

Requirements (device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows::UI::Xaml::Input

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (operating system)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows::UI::Xaml::Input

Metadata

Windows.winmd

 

 

Show:
© 2015 Microsoft