ICommand interface

Applies to Windows and Windows Phone

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 building Windows Store apps with the Microsoft .NET Framework, this interface is hidden and developers should use the System.Windows.Input.ICommand interface.

Note  Older versions of Microsoft .NET Framework reference documentation 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

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:
© 2014 Microsoft