RelayValueCommand<TValue>
RelayValueCommand<2>RelayCommand<1>A IValueCommand<T> class that uses delegates for getting and setting the value of the command
Remarks: This can be used to delegate the getting/setting of the value to separate methods. Call RelayValueCommand<TParameter, TValue>.UpdateValue() to signal that the value has changed.
Type parameters:
| TValue |
See Also: ValueCommand<T>
Constructors
RelayValueCommand
#Initializes a new instance of the RelayValueCommand class.
Parameters:
| getValue (Func<TValue>) | Delegate to get the value. |
| setValue (Action<TValue>) | Delegate to set value. |
| execute (Action = null) | Delegate to call when the command is executed (which usually changes the value). |
| canExecute (Func<bool> = null) | Delegate to call to determine if the command can be executed. |
Methods
CanExecute
Determines whether this command can execute with the specified parameter.
Parameters:
| parameter (object) | Command argument from the control. |
Returns:
true if this command can execute; otherwise, false.Parameters:
| parameter (object) | Command argument from the control. |
inherited fromRelayCommand<T>
Parameters:
| e (EventArgs) | Event arguments |
inherited fromRelayValueCommand<TParameter, TValue>
UpdateCanExecute
public void UpdateCanExecute()
Tells consumers of this command that the RelayCommand<T>.CanExecute(object) state has changed and should be queried again.
UpdateValue
public void UpdateValue()
Signals that the value has been updated and the delegate to get the value should be called.
Events
inherited fromRelayCommand<T>
ValueChanged
Event to signal to the control/widget that the value has been changed.
Remarks: Controls should call RelayValueCommand<TParameter, TValue>.GetValue(object) when this is raised so that they can set the state of the control to match the value provided.
Implements: ValueChanged