- RelayValueCommand<TValue>
public class RelayValueCommand<TParameter, TValue> : RelayCommand<TParameter>, IValueCommand<TValue>
A IValueCommand<T> class that uses delegates for getting and setting the value of the command with the command parameter.
Remarks: This can be used to delegate the getting/setting of the value to separate methods. Call UpdateValue() to signal that the value has changed.
Type parameters:
| TParameter | |
| TValue |
See Also: ValueCommand<T>
Constructors
RelayValueCommand
#Initializes a new instance of the RelayValueCommand class.
Parameters:
| getValue (Func<TParameter, TValue>) | Delegate to get the value. |
| setValue (Action<TParameter, TValue>) | Delegate to set value. |
| execute (Action<TParameter> = null) | Delegate to call when the command is executed, which usually changes the value. (optional). |
| canExecute (Predicate<TParameter> = null) | Delegate to call to determine if the command can be executed (optional). |
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. |
GetValue
#Gets the value.
inherited fromRelayCommand<T>
Parameters:
| e (EventArgs) | Event arguments |
SetValue
#Sets the value.
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 GetValue(object) when this is raised so that they can set the state of the control to match the value provided.
Implements: ValueChanged