Open sandboxFocus

Class DelegateCommand

An implementation of ICommand that uses delegates for the execute and can-execute logic, without accepting a command parameter. This class is typically generated by the CommandAttribute aspect.

Inheritance
DelegateCommand
Namespace: Metalama.Patterns.Wpf
Assembly: Metalama.Patterns.Wpf.dll
Syntax
public sealed class DelegateCommand : BaseDelegateCommand, ICommand, INotifyPropertyChanged
Remarks

This class implements INotifyPropertyChanged to notify when CanExecute changes. When integrated with an INotifyPropertyChanged implementation for the CanExecute property, the CanExecuteChanged event is automatically raised.

Properties

Name Description
CanExecute

Gets a value indicating whether the command can be executed. Returns true if no CanExecute delegate was provided, or if the delegate returns true.

Methods

Name Description
Execute()

Executes the command by invoking the execute delegate.

Execute(object?)

Executes the command. This overload is obsolete because this command type does not accept parameters.

Events

Name Description
PropertyChanged

Extension Methods

See Also