CommandState Class

Represents the states of a command for a specific command binding.
See the ICommandState interface for details and the Remarks section of ICommand interface for some examples.

Definition

Namespace: KGySoft.ComponentModel
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 7.0.0-rc.1
C#
public sealed class CommandState : DynamicObject, 
	ITypedList, IReadOnlyDictionary<string, Object>, IEnumerable<KeyValuePair<string, Object>>, 
	IEnumerable, IReadOnlyCollection<KeyValuePair<string, Object>>, 
	ICommandState, IDictionary<string, Object>, ICollection<KeyValuePair<string, Object>>, 
	INotifyPropertyChanged, ICustomTypeDescriptor
Inheritance
Object    DynamicObject    CommandState
Implements
ICommandState, ICollectionKeyValuePairString, Object, IDictionaryString, Object, IEnumerableKeyValuePairString, Object, IReadOnlyCollectionKeyValuePairString, Object, IReadOnlyDictionaryString, Object, IEnumerable, ICustomTypeDescriptor, INotifyPropertyChanged, ITypedList

Constructors

CommandState Initializes a new instance of the CommandState class from an initial configuration if provided.

Properties

AsDynamic Gets the state as a dynamic object so the states can be set by simple property setting syntax.
Count Gets the number of elements contained in the CommandState.
Enabled Gets or sets whether the command is enabled in the current binding.
Default value: .
Item Gets or sets the state value with the specified key.

Methods

Add Adds a state element with the provided key and value to the CommandState.
ContainsKey Determines whether the CommandState contains an element with the specified key.
GetEnumerator Returns an enumerator that iterates through the collection.
TryGetValue Gets the state element associated with the specified key.

Events

PropertyChanged Occurs when a state entry value changes.

Extension Methods

AddRangeKeyValuePairString, Object Adds a collection to the target ICollectionT.
(Defined by CollectionExtensions)
AsThreadSafeKeyValuePairString, Object Returns a LockingCollectionT, which provides a thread-safe wrapper for the specified collection. This only means that if the members are accessed through the returned LockingCollectionT, then the inner state of the wrapped collection remains always consistent and not that all of the multi-threading concerns can be ignored.
See the Remarks section of the LockingCollectionT class for details and some examples.
(Defined by CollectionExtensions)
Convert Converts an Object specified in the obj parameter to the desired targetType.
See the Examples section of the generic ConvertTTarget(Object, CultureInfo) overload for an example.
(Defined by ObjectExtensions)
ConvertTTarget Converts an Object specified in the obj parameter to the desired TTarget.
(Defined by ObjectExtensions)
CreatePropertyBinding Creates a special binding for the PropertyChanged event of the specified source, which allows to update the specified targetPropertyName in the targets, when the property of sourcePropertyName changes in the source.
(Defined by Command)
CreatePropertyBinding Creates a special binding for the PropertyChanged event of the specified source, which allows to update the specified targetPropertyName in the targets, when the property of sourcePropertyName changes in the source.
(Defined by Command)
CreatePropertyChangedHandlerBinding Creates a special command binding for the PropertyChanged event of the specified source that invokes the specified handler only when the changed property is among the specified propertyNames.
(Defined by Command)
CreatePropertyChangedHandlerBinding Creates a special command binding for the PropertyChanged event of the specified source that invokes the specified handler only when the changed property is among the specified propertyNames.
(Defined by Command)
CreateSynchronizedPropertyBinding Creates a special binding for the PropertyChanged event of the specified source, which allows to update the specified targetPropertyName in the targets, when the property of sourcePropertyName changes in the source. The target properties will be set using the SynchronizationContext of the thread on which this method was called.
(Defined by Command)
CreateSynchronizedPropertyBinding Creates a special binding for the PropertyChanged event of the specified source, which allows to update the specified targetPropertyName in the targets, when the property of sourcePropertyName changes in the source. The target properties will be set using the SynchronizationContext of the thread on which this method was called.
(Defined by Command)
CreateTwoWayPropertyBinding Creates a pair of special bindings for the PropertyChanged event of the specified source and target, which allow to update the specified targetPropertyName and sourcePropertyName in both directions when any of them changes.
(Defined by Command)
ForEachKeyValuePairString, Object Similarly to the List<T>.ForEach method, processes an action on each element of an enumerable collection.
(Defined by EnumerableExtensions)
GetRandomElementKeyValuePairString, Object Gets a random element from the enumerable source using a new FastRandom instance.
(Defined by EnumerableExtensions)
GetRandomElementKeyValuePairString, Object Gets a random element from the enumerable source using a specified Random instance.
(Defined by EnumerableExtensions)
GetValueOrDefaultTActualValue Tries to get the typed value from a string-object dictionary for the given key.
See the Examples section of the GetValueOrDefaultTActualValue(IDictionaryString, Object, String, TActualValue) method for some examples.
(Defined by DictionaryExtensions)
GetValueOrDefaultTActualValue Tries to get the typed value from a string-object dictionary for the given key.
(Defined by DictionaryExtensions)
In Gets whether item is among the elements of set.
See the Examples section of the generic InT(T, T) overload for an example.
(Defined by ObjectExtensions)
IndexOf Searches for an element in the source enumeration where the specified predicate returns .
(Defined by EnumerableExtensions)
IndexOf Searches for an element in the source enumeration.
(Defined by EnumerableExtensions)
IndexOfKeyValuePairString, Object Searches for an element in the source enumeration where the specified predicate returns .
(Defined by EnumerableExtensions)
IndexOfKeyValuePairString, Object Searches for an element in the source enumeration.
(Defined by EnumerableExtensions)
IsNullOrEmpty Determines whether the specified source is or empty (has no elements).
(Defined by EnumerableExtensions)
IsNullOrEmptyKeyValuePairString, Object Determines whether the specified source is or empty (has no elements).
(Defined by EnumerableExtensions)
JoinKeyValuePairString, Object Concatenates the items of the source collection into a new string instance using the specified separator between the items.
(Defined by EnumerableExtensions)
JoinKeyValuePairString, Object Concatenates the items of the source collection into a new string instance using the specified separator between the items.
(Defined by EnumerableExtensions)
ShuffleKeyValuePairString, Object Shuffles an enumerable source (randomizes its elements) using a new FastRandom instance.
(Defined by EnumerableExtensions)
ShuffleKeyValuePairString, Object Shuffles an enumerable source (randomizes its elements) using the provided seed with a new FastRandom instance.
(Defined by EnumerableExtensions)
ShuffleKeyValuePairString, Object Shuffles an enumerable source (randomizes its elements) using the provided seed with a new FastRandom instance.
(Defined by EnumerableExtensions)
ShuffleKeyValuePairString, Object Shuffles an enumerable source (randomizes its elements) using a specified Random instance.
(Defined by EnumerableExtensions)
ToCircularListKeyValuePairString, Object Creates a CircularListT from an IEnumerableT.
(Defined by EnumerableExtensions)
ToStringKeyedDictionaryKeyValuePairString, Object Creates a StringKeyedDictionaryTValue from an IEnumerableT instance using the specified keySelector delegate and a comparer.
(Defined by EnumerableExtensions)
ToStringKeyedDictionaryKeyValuePairString, Object, TValue Creates a StringKeyedDictionaryTValue from an IEnumerableT instance using the specified key and value selector delegates and a comparer.
(Defined by EnumerableExtensions)
TryAdd Tries to add the specified item to the collection.
(Defined by EnumerableExtensions)
TryAddKeyValuePairString, Object Tries to add the specified item to the collection.
(Defined by EnumerableExtensions)
TryAddRange Tries to add the specified collection to the target collection.
(Defined by EnumerableExtensions)
TryAddRangeKeyValuePairString, Object Tries to add the specified collection to the target collection.
(Defined by EnumerableExtensions)
TryClear Tries to remove all elements from the collection.
(Defined by EnumerableExtensions)
TryClearKeyValuePairString, Object Tries to remove all elements from the collection.
(Defined by EnumerableExtensions)
TryConvert Tries to convert an Object specified in the obj parameter to the desired targetType.
See the Examples section of the ConvertTTarget(Object, CultureInfo) method for a related example.
(Defined by ObjectExtensions)
TryConvert Tries to convert an Object specified in the obj parameter to the desired targetType.
See the Examples section of the ConvertTTarget(Object, CultureInfo) method for a related example.
(Defined by ObjectExtensions)
TryConvertTTarget Tries to convert an Object specified in the obj parameter to the desired TTarget.
See the Examples section of the ConvertTTarget(Object, CultureInfo) method for a related example.
(Defined by ObjectExtensions)
TryConvertTTarget Tries to convert an Object specified in the obj parameter to the desired TTarget.
See the Examples section of the ConvertTTarget(Object, CultureInfo) method for a related example.
(Defined by ObjectExtensions)
TryGetCount Tries to get the number of elements in the source enumeration without enumerating it.
(Defined by EnumerableExtensions)
TryGetCountKeyValuePairString, Object Tries to get the number of elements in the source enumeration without enumerating it.
(Defined by EnumerableExtensions)
TryGetElementAt Tries to get an item at the specified index in the collection.
(Defined by EnumerableExtensions)
TryGetElementAtKeyValuePairString, Object Tries to get an item at the specified index in the collection.
(Defined by EnumerableExtensions)
TryInsert Tries to insert the specified item at the specified index to the collection.
(Defined by EnumerableExtensions)
TryInsertKeyValuePairString, Object Tries to insert the specified item at the specified index to the collection.
(Defined by EnumerableExtensions)
TryInsertRange Tries to insert the specified collection into the target collection.
(Defined by EnumerableExtensions)
TryInsertRangeKeyValuePairString, Object Tries to insert the specified collection into the target collection.
(Defined by EnumerableExtensions)
TryRemove Tries to remove the specified item from to the collection.
(Defined by EnumerableExtensions)
TryRemoveKeyValuePairString, Object Tries to remove the specified item from to the collection.
(Defined by EnumerableExtensions)
TryRemoveAt Tries to remove an item at the specified index from the collection.
(Defined by EnumerableExtensions)
TryRemoveAtKeyValuePairString, Object Tries to remove an item at the specified index from the collection.
(Defined by EnumerableExtensions)
TryRemoveRange Tries to remove count amount of items from the specified collection at the specified index.
(Defined by EnumerableExtensions)
TryRemoveRangeKeyValuePairString, Object Tries to remove count amount of items from the specified collection at the specified index.
(Defined by EnumerableExtensions)
TryReplaceRange Tries to remove count amount of items from the target at the specified index, and to insert the specified collection at the same position. The number of elements in collection can be different from the amount of removed items.
(Defined by EnumerableExtensions)
TryReplaceRangeKeyValuePairString, Object Tries to remove count amount of items from the target at the specified index, and to insert the specified collection at the same position. The number of elements in collection can be different from the amount of removed items.
(Defined by EnumerableExtensions)
TrySetElementAt Tries to set the specified item at the specified index in the collection.
(Defined by EnumerableExtensions)
TrySetElementAtKeyValuePairString, Object Tries to set the specified item at the specified index in the collection.
(Defined by EnumerableExtensions)

See Also