Daniel's XL Toolbox NG
Bovender.Mvvm.DelegatingCommand Class Reference

Command that implements ICommand and accepts delegates that contain the command implementation. More...

Inheritance diagram for Bovender.Mvvm.DelegatingCommand:
Collaboration diagram for Bovender.Mvvm.DelegatingCommand:

Public Member Functions

 DelegatingCommand (Action< object > execute)
 Creates a new command object that can always execute. More...
 
 DelegatingCommand (Action< object > execute, ViewModelBase viewModel)
 Creates a new command object that knows the view model that it belongs to. More...
 
 DelegatingCommand (Action< object > execute, Predicate< object > canExecute)
 Creates a new command object whose executable state is determined by the canExecute method. More...
 
 DelegatingCommand (Action< object > execute, Predicate< object > canExecute, ViewModelBase viewModel)
 Creates a new command object whose executable state is determined by the canExecute method and that know the view model that it belongs to. More...
 
bool CanExecute (object parameter)
 
void Execute (object parameter)
 
DelegatingCommand ListenOn (string propertyName)
 Makes DelegateCommnand listen on PropertyChanged events of some object, so that DelegateCommnand can update its IsEnabled property. More...
 
 DelegatingCommand (Action< object > execute)
 Creates a new command object that can always execute. More...
 
 DelegatingCommand (Action< object > execute, ViewModelBase viewModel)
 Creates a new command object that knows the view model that it belongs to. More...
 
 DelegatingCommand (Action< object > execute, Predicate< object > canExecute)
 Creates a new command object whose executable state is determined by the canExecute method. More...
 
 DelegatingCommand (Action< object > execute, Predicate< object > canExecute, ViewModelBase viewModel)
 Creates a new command object whose executable state is determined by the canExecute method and that know the view model that it belongs to. More...
 
bool CanExecute (object parameter)
 
void Execute (object parameter)
 
DelegatingCommand ListenOn (string propertyName)
 Makes DelegateCommnand listen on PropertyChanged events of some object, so that DelegateCommnand can update its IsEnabled property. More...
 

Protected Member Functions

virtual void OnCanExecuteChanged ()
 
virtual void OnCanExecuteChanged ()
 

Properties

EventHandler CanExecuteChanged
 

Detailed Description

Command that implements ICommand and accepts delegates that contain the command implementation.

Based on Josh Smith's article in MSDN Magazine, http://msdn.microsoft.com/en-us/magazine/dd419663.aspx. ListenOn method inspired by http://stackoverflow.com/a/1857619/270712 by Tomas Kafka http://stackoverflow.com/users/38729/tom%C3%A1%C5%A1-kafka (CC BY-SA 3.0)

Constructor & Destructor Documentation

◆ DelegatingCommand() [1/8]

Bovender.Mvvm.DelegatingCommand.DelegatingCommand ( Action< object >  execute)
inline

Creates a new command object that can always execute.

Parameters
executeCode that will be executed.

◆ DelegatingCommand() [2/8]

Bovender.Mvvm.DelegatingCommand.DelegatingCommand ( Action< object >  execute,
ViewModelBase  viewModel 
)
inline

Creates a new command object that knows the view model that it belongs to.

Parameters
executeExecute method.
viewModelView model that this command belongs to.

◆ DelegatingCommand() [3/8]

Bovender.Mvvm.DelegatingCommand.DelegatingCommand ( Action< object >  execute,
Predicate< object >  canExecute 
)
inline

Creates a new command object whose executable state is determined by the canExecute method.

Parameters
executeExecute method.
canExecuteFunction that determines whether the command can be executed or not.

◆ DelegatingCommand() [4/8]

Bovender.Mvvm.DelegatingCommand.DelegatingCommand ( Action< object >  execute,
Predicate< object >  canExecute,
ViewModelBase  viewModel 
)
inline

Creates a new command object whose executable state is determined by the canExecute method and that know the view model that it belongs to.

Parameters
executeExecute method.
canExecuteFunction that determines whether the command can be executed or not.
viewModelView model that this command belongs to.

◆ DelegatingCommand() [5/8]

Bovender.Mvvm.DelegatingCommand.DelegatingCommand ( Action< object >  execute)
inline

Creates a new command object that can always execute.

Parameters
executeCode that will be executed.

◆ DelegatingCommand() [6/8]

Bovender.Mvvm.DelegatingCommand.DelegatingCommand ( Action< object >  execute,
ViewModelBase  viewModel 
)
inline

Creates a new command object that knows the view model that it belongs to.

Parameters
executeExecute method.
viewModelView model that this command belongs to.

◆ DelegatingCommand() [7/8]

Bovender.Mvvm.DelegatingCommand.DelegatingCommand ( Action< object >  execute,
Predicate< object >  canExecute 
)
inline

Creates a new command object whose executable state is determined by the canExecute method.

Parameters
executeExecute method.
canExecuteFunction that determines whether the command can be executed or not.

◆ DelegatingCommand() [8/8]

Bovender.Mvvm.DelegatingCommand.DelegatingCommand ( Action< object >  execute,
Predicate< object >  canExecute,
ViewModelBase  viewModel 
)
inline

Creates a new command object whose executable state is determined by the canExecute method and that know the view model that it belongs to.

Parameters
executeExecute method.
canExecuteFunction that determines whether the command can be executed or not.
viewModelView model that this command belongs to.

Member Function Documentation

◆ CanExecute() [1/2]

bool Bovender.Mvvm.DelegatingCommand.CanExecute ( object  parameter)
inline

◆ CanExecute() [2/2]

bool Bovender.Mvvm.DelegatingCommand.CanExecute ( object  parameter)
inline

◆ Execute() [1/2]

void Bovender.Mvvm.DelegatingCommand.Execute ( object  parameter)
inline

◆ Execute() [2/2]

void Bovender.Mvvm.DelegatingCommand.Execute ( object  parameter)
inline

◆ ListenOn() [1/2]

DelegatingCommand Bovender.Mvvm.DelegatingCommand.ListenOn ( string  propertyName)
inline

Makes DelegateCommnand listen on PropertyChanged events of some object, so that DelegateCommnand can update its IsEnabled property.

◆ ListenOn() [2/2]

DelegatingCommand Bovender.Mvvm.DelegatingCommand.ListenOn ( string  propertyName)
inline

Makes DelegateCommnand listen on PropertyChanged events of some object, so that DelegateCommnand can update its IsEnabled property.

◆ OnCanExecuteChanged() [1/2]

virtual void Bovender.Mvvm.DelegatingCommand.OnCanExecuteChanged ( )
inlineprotectedvirtual

◆ OnCanExecuteChanged() [2/2]

virtual void Bovender.Mvvm.DelegatingCommand.OnCanExecuteChanged ( )
inlineprotectedvirtual

Property Documentation

◆ CanExecuteChanged

EventHandler Bovender.Mvvm.DelegatingCommand.CanExecuteChanged
addremove

The documentation for this class was generated from the following file: