CommandBindingsCollection Class

Represents a collection of command bindings. If a component or control uses events, then this class can be used to create and hold the event bindings, regardless of any used technology. When this class is disposed, all of the internally subscribed events will be released at once. Removed and replaced bindings will also be disposed.
See the Remarks section of the ICommand interface for details and examples about commands.

Definition

Namespace: KGySoft.ComponentModel
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 7.0.0-rc.1
C#
public class CommandBindingsCollection : FastLookupCollection<ICommandBinding>, 
	IDisposable
Inheritance
Object    VirtualCollectionICommandBinding    FastLookupCollectionICommandBinding    CommandBindingsCollection
Implements
IDisposable

Constructors

CommandBindingsCollectionInitializes a new instance of the CommandBindingsCollection class

Properties

CanSetItem Gets whether an item can be set through the indexer.
The base implementation returns if IsReadOnly returns or when the wrapped collection is a one dimensional zero based array of T; otherwise, returns .
(Inherited from VirtualCollectionT)
CheckConsistency Gets or sets whether consistency of the stored items should be checked when items are get or set in the collection.
Default value: , if the FastLookupCollectionT was initialized by the default constructor; otherwise, as it was specified.
(Inherited from FastLookupCollectionT)
Count Gets the number of elements actually contained in the VirtualCollectionT.
The base implementation returns the Count property of the underlying collection.
(Inherited from VirtualCollectionT)
IsReadOnly Gets whether the VirtualCollectionT is read-only. Affects the behavior of Add, Insert, Remove, RemoveAt and Clear methods.
The base implementation returns the IsReadOnly property of the underlying collection.
(Inherited from VirtualCollectionT)
Item Gets or sets the element at the specified index.
When read, calls the overridable GetItem method, and when set, calls the overridable SetItem method.
(Inherited from VirtualCollectionT)
Items Gets the wrapped underlying collection maintained by this VirtualCollectionT instance.
(Inherited from VirtualCollectionT)

Methods

Add(T) Adds an object to the end of the VirtualCollectionT.
Calls the overridable InsertItem method.
(Inherited from VirtualCollectionT)
Add(Action, IDictionaryString, Object) Creates a binding with an internally created disposable SimpleCommand for the specified callback without any sources and targets. At least one source must be added by the ICommandBinding.AddSource method to make the command invokable. The created binding will be added to this CommandBindingsCollection.
Add(ActionICommandState, IDictionaryString, Object) Creates a binding with an internally created disposable SimpleCommand for the specified callback without any sources and targets. At least one source must be added by the ICommandBinding.AddSource method to make the command invokable. The created binding will be added to this CommandBindingsCollection.
Add(ICommand, IDictionaryString, Object, Boolean) Creates a binding for a command without any sources and targets. At least one source must be added by the ICommandBinding.AddSource method to make the command invokable. Targets can be added by the ICommandBinding.AddTarget method. The created binding will be added to this CommandBindingsCollection.
Add(ICommand, Object, String, Object) Creates a binding for a command using the specified source, eventName and targets. The created binding will be added to this CommandBindingsCollection.
Add(ICommand, Object, String, IDictionaryString, Object, Object) Creates a binding for a command using the specified source, eventName and targets as well as the optionally provided initial state of the binding. The created binding will be added to this CommandBindingsCollection.
AddTTarget(ActionTTarget, IDictionaryString, Object) Creates a binding with an internally created disposable TargetedCommandTTarget for the specified callback without any sources and targets. At least one source must be added by the ICommandBinding.AddSource method to make the command invokable. Targets can be added by the ICommandBinding.AddTarget method. The created binding will be added to this CommandBindingsCollection.
AddTEventArgs(ActionICommandSourceTEventArgs, IDictionaryString, Object) Creates a binding with an internally created disposable SourceAwareCommandTEventArgs for the specified callback without any sources and targets. At least one source must be added by the ICommandBinding.AddSource method to make the command invokable. The created binding will be added to this CommandBindingsCollection.
AddTEventArgs(ActionICommandSourceTEventArgs, ICommandState, IDictionaryString, Object) Creates a binding with an internally created disposable SourceAwareCommandTEventArgs for the specified callback without any sources and targets. At least one source must be added by the ICommandBinding.AddSource method to make the command invokable. The created binding will be added to this CommandBindingsCollection.
AddTTarget(ActionICommandState, TTarget, IDictionaryString, Object) Creates a binding with an internally created disposable TargetedCommandTTarget for the specified callback without any sources and targets. At least one source must be added by the ICommandBinding.AddSource method to make the command invokable. Targets can be added by the ICommandBinding.AddTarget method. The created binding will be added to this CommandBindingsCollection.
AddTParam(ActionTParam, FuncTParam, IDictionaryString, Object) Creates a binding with an internally created disposable SimpleCommandTParam for the specified callback without any sources and targets. At least one source must be added by the ICommandBinding.AddSource method to make the command invokable. The created binding will be added to this CommandBindingsCollection.
AddTParam(ActionICommandState, TParam, FuncTParam, IDictionaryString, Object) Creates a binding with an internally created disposable SimpleCommandTParam for the specified callback without any sources and targets. At least one source must be added by the ICommandBinding.AddSource method to make the command invokable. The created binding will be added to this CommandBindingsCollection.
AddTEventArgs, TTarget(ActionICommandSourceTEventArgs, TTarget, IDictionaryString, Object) Creates a binding with an internally created disposable SourceAwareTargetedCommandTEventArgs, TTarget for the specified callback without any sources and targets. At least one source must be added by the ICommandBinding.AddSource method to make the command invokable. Targets can be added by the ICommandBinding.AddTarget method. The created binding will be added to this CommandBindingsCollection.
AddTEventArgs, TTarget(ActionICommandSourceTEventArgs, ICommandState, TTarget, IDictionaryString, Object) Creates a binding with an internally created disposable SourceAwareTargetedCommandTEventArgs, TTarget for the specified callback without any sources and targets. At least one source must be added by the ICommandBinding.AddSource method to make the command invokable. Targets can be added by the ICommandBinding.AddTarget method. The created binding will be added to this CommandBindingsCollection.
AddTTarget, TParam(ActionTTarget, TParam, FuncTParam, IDictionaryString, Object) Creates a binding with an internally created disposable TargetedCommandTTarget, TParam for the specified callback without any sources and targets. At least one source must be added by the ICommandBinding.AddSource method to make the command invokable. Targets can be added by the ICommandBinding.AddTarget method. The created binding will be added to this CommandBindingsCollection.
AddTEventArgs, TParam(ActionICommandSourceTEventArgs, TParam, FuncTParam, IDictionaryString, Object) Creates a binding with an internally created disposable SourceAwareCommandTEventArgs, TParam for the specified callback without any sources and targets. At least one source must be added by the ICommandBinding.AddSource method to make the command invokable. The created binding will be added to this CommandBindingsCollection.
AddTEventArgs, TParam(ActionICommandSourceTEventArgs, ICommandState, TParam, FuncTParam, IDictionaryString, Object) Creates a binding with an internally created disposable SourceAwareCommandTEventArgs, TParam for the specified callback without any sources and targets. At least one source must be added by the ICommandBinding.AddSource method to make the command invokable. The created binding will be added to this CommandBindingsCollection.
AddTTarget, TParam(ActionICommandState, TTarget, TParam, FuncTParam, IDictionaryString, Object) Creates a binding with an internally created disposable TargetedCommandTTarget, TParam for the specified callback without any sources and targets. At least one source must be added by the ICommandBinding.AddSource method to make the command invokable. Targets can be added by the ICommandBinding.AddTarget method. The created binding will be added to this CommandBindingsCollection.
AddTEventArgs, TTarget, TParam(ActionICommandSourceTEventArgs, TTarget, TParam, FuncTParam, IDictionaryString, Object) Creates a binding with an internally created disposable SourceAwareTargetedCommandTEventArgs, TTarget, TParam for the specified callback without any sources and targets. At least one source must be added by the ICommandBinding.AddSource method to make the command invokable. Targets can be added by the ICommandBinding.AddTarget method. The created binding will be added to this CommandBindingsCollection.
AddTEventArgs, TTarget, TParam(ActionICommandSourceTEventArgs, ICommandState, TTarget, TParam, FuncTParam, IDictionaryString, Object) Creates a binding with an internally created disposable SourceAwareTargetedCommandTEventArgs, TTarget, TParam for the specified callback without any sources and targets. At least one source must be added by the ICommandBinding.AddSource method to make the command invokable. Targets can be added by the ICommandBinding.AddTarget method. The created binding will be added to this CommandBindingsCollection.
AddPropertyBinding(Object, String, String, Object) Creates a special binding for the PropertyChanged or sourcePropertyNameChanged event of the specified source, which allows to update the specified targetPropertyName in the targets, when the property of sourcePropertyName changes in the source.
AddPropertyBinding(Object, String, String, FuncObject, Object, Object) Creates a special binding for the PropertyChanged or sourcePropertyNameChanged event of the specified source, which allows to update the specified targetPropertyName in the targets, when the property of sourcePropertyName changes in the source.
AddPropertyChangedHandlerBinding(INotifyPropertyChanged, Action, String) 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.
AddPropertyChangedHandlerBinding(INotifyPropertyChanged, ActionString, String) 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.
AddSynchronizedPropertyBinding(Object, String, String, Boolean, Object) Creates a special binding for the PropertyChanged or sourcePropertyNameChanged 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.
AddSynchronizedPropertyBinding(Object, String, String, FuncObject, Object, Boolean, Object) Creates a special binding for the PropertyChanged or sourcePropertyNameChanged 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.
AddTwoWayPropertyBinding Creates a pair of special bindings for the PropertyChanged or sourcePropertyNameChanged event of the specified source and target, which allow to update the specified targetPropertyName and sourcePropertyName in both directions when any of them changes.
Clear Removes all elements from the VirtualCollectionT.
Calls the overridable ClearItems method.
(Inherited from VirtualCollectionT)
ClearItems Removes all elements from the CommandBindingsCollection. The removed bindings will be disposed.
(Overrides FastLookupCollectionTClearItems)
Contains Determines whether an element is in the VirtualCollectionT.
Calls the overridable ContainsItem method.
(Inherited from VirtualCollectionT)
ContainsItem Gets whether the specified item is in the VirtualCollectionT.
The base implementation calls the GetItemIndex method.
(Inherited from VirtualCollectionT)
CopyTo Copies the entire VirtualCollectionT to a compatible one-dimensional Array, starting at the specified arrayIndex of the target array.
Calls the overridable GetItem method for each index between zero and Count, excluding upper bound.
(Inherited from VirtualCollectionT)
Dispose Releases every binding in this CommandBindingsCollection.
Dispose(Boolean) Releases every binding in this CommandBindingsCollection.
GetEnumerator Returns an enumerator that iterates through the VirtualCollectionT.
The base implementation returns the enumerator of the underlying collection.
(Inherited from VirtualCollectionT)
GetItem Gets the element at the specified index.
The base implementation gets the element at the specified index by calling the indexer of the underlying collection.
(Inherited from VirtualCollectionT)
GetItemIndex Gets the zero-based index of the first of the specified item within the FastLookupCollectionT.
(Inherited from FastLookupCollectionT)
IndexOf Searches for the specified object and returns the zero-based index of an occurrence within the entire VirtualCollectionT.
Calls the overridable GetItemIndex method.
(Inherited from VirtualCollectionT)
InnerListChanged Invalidates the internally stored index mapping. Call if the wrapped list that has been passed to the constructor has been changed explicitly.
(Inherited from FastLookupCollectionT)
Insert Inserts an element into the VirtualCollectionT at the specified index.
Calls the overridable InsertItem method.
(Inherited from VirtualCollectionT)
InsertItem Inserts a binding into the CommandBindingsCollection at the specified index.
(Overrides FastLookupCollectionTInsertItem(Int32, T))
OnMapRebuilt Called after the internal index map has been rebuilt either when inconsistency has been detected or when InnerListChanged has been called.
(Inherited from FastLookupCollectionT)
Remove Removes one occurrence of a specific object from the VirtualCollectionT.
Calls the overridable RemoveItem method.
(Inherited from VirtualCollectionT)
RemoveAt Removes the element at the specified index of the VirtualCollectionT.
Calls the overridable RemoveItem method.
(Inherited from VirtualCollectionT)
RemoveItem Removes the first occurrence of item from the FastLookupCollectionT.
(Inherited from FastLookupCollectionT)
RemoveItemAt Removes the binding at the specified index of the CommandBindingsCollection. The removed binding will be disposed.
(Overrides FastLookupCollectionTRemoveItemAt(Int32))
SetItem Replaces the binding at the specified index. The overridden binding will be disposed.
(Overrides FastLookupCollectionTSetItem(Int32, T))

Extension Methods

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)
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)
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)

See Also