Click or drag to resize

DelegateCommandT Class

A simple, straight forward delegate command implementation. For usage see MVVM concepts.
Inheritance Hierarchy
SystemObject
  TomsToolbox.WpfDelegateCommandT

Namespace:  TomsToolbox.Wpf
Assembly:  TomsToolbox.Wpf (in TomsToolbox.Wpf.dll)
Syntax
public class DelegateCommand<T> : ICommand

Type Parameters

T
The type of the command parameter.

The DelegateCommandT type exposes the following members.

Constructors
  NameDescription
Public methodCode exampleDelegateCommandT
Initializes a new instance of the DelegateCommandT class.

No callback is initially set, so they must be set via the property setters. This usage generates easy readable code even if the delegates are inlined.

Public methodCode exampleDelegateCommandT(ActionT)
Initializes a new instance of the DelegateCommandT class with the execute callback.

This version generates more compact code; not recommended for in-line delegates.

Public methodCode exampleDelegateCommandT(PredicateT, ActionT)
Initializes a new instance of the DelegateCommandT class.
Top
Properties
  NameDescription
Public propertyCanExecuteCallback
Gets or sets the predicate to handle the ICommand.CanExecute method. If unset, ICommand.CanExecute will always return true if ExecuteCallback is set.
Public propertyExecuteCallback
Gets or sets the action to handle the ICommand.Execute method. If unset, ICommand.CanExecute will always return false.
Top
Methods
  NameDescription
Public methodCanExecute
Defines the method that determines whether the command can execute in its current state.
Public methodExecute
Defines the method to be called when the command is invoked.
Top
Events
  NameDescription
Public eventCanExecuteChanged
Occurs when changes occur that affect whether or not the command should execute.
Top
Extension Methods
See Also