Click or drag to resize

DelegateCommandT Constructor

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.

Namespace:  TomsToolbox.Wpf
Assembly:  TomsToolbox.Wpf (in TomsToolbox.Wpf.dll)
Syntax
public DelegateCommand()
Examples
C#
public ICommand DeleteCommand
{
    get
    {
        return new DelegateCommand<Item>
        {
            CanExecuteCallback = item =>
            {
                return IsSomethingSelected(item);
            },
            ExecuteCallback = item =>
            {
                if (IsSomehingSelected(item))
                {
                    DelteTheSelection();
                }
            }
        };
    }
}
See Also