Table of Contents

Class ObservableCommandState<TParameter>

Namespace
CarinaStudio.Windows.Input
Assembly
CarinaStudio.AppBase.Application.dll
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 ICommand

ICommand to bind to.

parameter TParameter

Parameter of command.

defaultValue bool

Default value used when no ICommand bound.

Properties

Command

Get ICommand currently bound by this instance.

public ICommand? Command { get; }

Property Value

ICommand

Methods

Bind(ICommand, TParameter?)

Bind to ICommand.

public void Bind(ICommand command, TParameter? parameter = default)

Parameters

command ICommand

ICommand to bind to.

parameter TParameter

Parameter of command.

Exceptions

InvalidOperationException

Instance is already bound to another command.

~ObservableCommandState()

Finalizer.

protected ~ObservableCommandState()

Unbind()

Unbind from current ICommand.

public void Unbind()