bovender framework
C# framework that implements MVVM and more
Bovender.Mvvm.DelegatingCommand Class Reference

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

Inheritance 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...
 

Protected Member Functions

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)

Definition at line 38 of file DelegatingCommand.cs.

Constructor & Destructor Documentation

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

Creates a new command object that can always execute.

Parameters
executeCode that will be executed.

Definition at line 46 of file DelegatingCommand.cs.

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.

Definition at line 56 of file DelegatingCommand.cs.

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.

Definition at line 69 of file DelegatingCommand.cs.

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.

Definition at line 87 of file DelegatingCommand.cs.

Member Function Documentation

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.

Definition at line 142 of file DelegatingCommand.cs.


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