WinFormsCommandBindingsCollection Class

A specialized CommandBindingsCollection that can be used for commands with Control sources. By using this collection, the ICommandState properties (e.g. Enabled, but also any other dynamically added property) of the added bindings will be synced with the command sources. It also supports cross-thread updates, if its SupportCrossThreadStateUpdates property is set to .

Definition

Namespace: KGySoft.ComponentModel
Assembly: KGySoft.WinForms (in KGySoft.WinForms.dll) Version: 5.0.1
C#
public class WinFormsCommandBindingsCollection : CommandBindingsCollection
Inheritance
Object    VirtualCollectionICommandBinding    FastLookupCollectionICommandBinding    CommandBindingsCollection    WinFormsCommandBindingsCollection

Remarks

Constructors

WinFormsCommandBindingsCollectionInitializes a new instance of the WinFormsCommandBindingsCollection 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 VirtualCollectionICommandBinding)
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 FastLookupCollectionICommandBinding)
Count Gets the number of elements actually contained in the VirtualCollectionT.
The base implementation returns the Count property of the underlying collection.
(Inherited from VirtualCollectionICommandBinding)
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 VirtualCollectionICommandBinding)
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 VirtualCollectionICommandBinding)
Items Gets the wrapped underlying collection maintained by this VirtualCollectionT instance.
(Inherited from VirtualCollectionICommandBinding)
SupportCrossThreadStateUpdates Gets or sets whether cross-thread state updates are supported. It is relevant when the command source is a Control or a ToolStripItem, and the command states (e.g. Enabled) may change from a different thread than the one the command binding was created on.
Default value: .

Methods

Add(T) Adds an object to the end of the VirtualCollectionT.
Calls the overridable InsertItem method.
(Inherited from VirtualCollectionICommandBinding)
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.
(Inherited from 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.
(Inherited from 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.
(Overrides CommandBindingsCollectionAdd(ICommand, IDictionaryString, Object, Boolean))
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.
(Inherited from 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.
(Inherited from 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.
(Inherited from 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.
(Inherited from 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.
(Inherited from 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.
(Inherited from 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.
(Inherited from 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.
(Inherited from 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.
(Inherited from 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.
(Inherited from 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.
(Inherited from 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.
(Inherited from 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.
(Inherited from 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.
(Inherited from 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.
(Inherited from 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.
(Inherited from 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.
(Inherited from CommandBindingsCollection)
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.
(Inherited from CommandBindingsCollection)
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.
(Inherited from CommandBindingsCollection)
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.
(Inherited from CommandBindingsCollection)
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.
(Inherited from CommandBindingsCollection)
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.
(Inherited from CommandBindingsCollection)
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.
(Inherited from CommandBindingsCollection)
Clear Removes all elements from the VirtualCollectionT.
Calls the overridable ClearItems method.
(Inherited from VirtualCollectionICommandBinding)
ClearItems Removes all elements from the CommandBindingsCollection. The removed bindings will be disposed.
(Inherited from CommandBindingsCollection)
Contains Determines whether an element is in the VirtualCollectionT.
Calls the overridable ContainsItem method.
(Inherited from VirtualCollectionICommandBinding)
ContainsItem Gets whether the specified item is in the VirtualCollectionT.
The base implementation calls the GetItemIndex method.
(Inherited from VirtualCollectionICommandBinding)
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 VirtualCollectionICommandBinding)
Dispose Releases every binding in this CommandBindingsCollection.
(Inherited from CommandBindingsCollection)
Dispose(Boolean) Releases every binding in this CommandBindingsCollection.
(Inherited from CommandBindingsCollection)
GetEnumerator Returns an enumerator that iterates through the VirtualCollectionT.
The base implementation returns the enumerator of the underlying collection.
(Inherited from VirtualCollectionICommandBinding)
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 VirtualCollectionICommandBinding)
GetItemIndex Gets the zero-based index of the first of the specified item within the FastLookupCollectionT.
(Inherited from FastLookupCollectionICommandBinding)
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 VirtualCollectionICommandBinding)
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 FastLookupCollectionICommandBinding)
Insert Inserts an element into the VirtualCollectionT at the specified index.
Calls the overridable InsertItem method.
(Inherited from VirtualCollectionICommandBinding)
InsertItem Inserts a binding into the CommandBindingsCollection at the specified index.
(Inherited from CommandBindingsCollection)
OnMapRebuilt Called after the internal index map has been rebuilt either when inconsistency has been detected or when InnerListChanged has been called.
(Inherited from FastLookupCollectionICommandBinding)
Remove Removes one occurrence of a specific object from the VirtualCollectionT.
Calls the overridable RemoveItem method.
(Inherited from VirtualCollectionICommandBinding)
RemoveAt Removes the element at the specified index of the VirtualCollectionT.
Calls the overridable RemoveItem method.
(Inherited from VirtualCollectionICommandBinding)
RemoveItem Removes the first occurrence of item from the FastLookupCollectionT.
(Inherited from FastLookupCollectionICommandBinding)
RemoveItemAt Removes the binding at the specified index of the CommandBindingsCollection. The removed binding will be disposed.
(Inherited from CommandBindingsCollection)
SetItem Replaces the binding at the specified index. The overridden binding will be disposed.
(Inherited from CommandBindingsCollection)

See Also