ICommandStateUpdater Interface

KGy SOFT Core Libraries Help
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 (eg. text, image, shortcut, etc.) can be applied to the sources.
See the Remarks section for details.

Namespace:  KGySoft.ComponentModel
Assembly:  KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 6.0.0

public interface ICommandStateUpdater : IDisposable

The ICommandStateUpdater type exposes the following members.


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

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 Tip
See the Remarks section of the ICommand interface for details and examples about commands.
See Also