Class ObservableCommandState<TParameter>
- Namespace
- CarinaStudio.Windows.Input
- Assembly
- CarinaStudio.AppBase.Application.dll
IObservable<T> which reflects CanExecute(object).
public class ObservableCommandState<TParameter> : ObservableValue<bool>, IObservable<bool>
Type Parameters
TParameter
Type of parameter of command.
- Inheritance
-
ObservableCommandState<TParameter>
- Implements
- Inherited Members
- Extension Methods
Remarks
ObservableCommandState<TParameter> uses weak event handler to monitor state of ICommand so it is not necessary to unbind from ICommand explicitly.
Constructors
ObservableCommandState(ICommand?, TParameter?, bool)
Initialize new ObservableCommandState<TParameter> instance.
public ObservableCommandState(ICommand? command = null, TParameter? parameter = default, bool defaultValue = false)
Parameters
command
ICommandICommand to bind to.
parameter
TParameterParameter of command.
defaultValue
boolDefault value used when no ICommand bound.
Properties
Command
Get ICommand currently bound by this instance.
public ICommand? Command { get; }
Property Value
Methods
Bind(ICommand, TParameter?)
Bind to ICommand.
public void Bind(ICommand command, TParameter? parameter = default)
Parameters
Exceptions
- InvalidOperationException
Instance is already bound to another command.
~ObservableCommandState()
Finalizer.
protected ~ObservableCommandState()
Unbind()
Unbind from current ICommand.
public void Unbind()