ICommandStateUpdater Interface

Represents an updater for the ICommandState entries that apply the state values on the command source instances. For example, if the command source is a UI element such as a button or menu item, then the Enabled property or any arbitrary state (e.g. text, image, shortcut, etc.) can be applied to the sources.

Definition

Namespace: KGySoft.ComponentModel
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 10.0.0
C#
public interface ICommandStateUpdater : IDisposable
Implements
IDisposable

Remarks

If a binding has no updaters, then the states are not synchronized back to the sources.

A state updater can be added to a binding by the ICommandBinding.AddStateUpdater method. Multiple updaters can be added so if the first one cannot apply a state entry, then the second one will be used as a fallback and so on.

If state entries represent properties on the source use can add the PropertyCommandStateUpdater to the ICommandBinding.

If you want to seal the falling back logic of the updaters you can use the NullStateUpdater after the last updater you want to allow to work. If the NullStateUpdater is the first added updater, then synchronization of the states will be completely disabled even if other updaters are chained.

  Tip

See the Remarks section of the ICommand interface for details and examples about commands.

Methods

TryUpdateState Tries to apply the specified state on the command source. If returns , then the possible chained other updaters can try to update the state.

See Also