KGy SOFT

CommandBindingsCollection Class

KGy SOFT Core Libraries Help
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.
Inheritance Hierarchy

SystemObject
  KGySoft.Collections.ObjectModelVirtualCollectionICommandBinding
    KGySoft.Collections.ObjectModelFastLookupCollectionICommandBinding
      KGySoft.ComponentModelCommandBindingsCollection

Namespace:  KGySoft.ComponentModel
Assembly:  KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 5.0.0-rc.1
Syntax

public class CommandBindingsCollection : FastLookupCollection<ICommandBinding>, 
	IDisposable

The CommandBindingsCollection type exposes the following members.

Constructors

  NameDescription
Public methodCommandBindingsCollection
Initializes a new instance of the CommandBindingsCollection class
Top
Properties

  NameDescription
Protected propertyCanSetItem
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.)
Public propertyCheckConsistency
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.)
Public propertyCount (Inherited from VirtualCollectionT.)
Public propertyIsReadOnly
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.)
Public propertyItem
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.)
Protected propertyItems (Inherited from VirtualCollectionT.)
Top
Methods

  NameDescription
Public methodAdd(T) (Inherited from VirtualCollectionT.)
Public methodAdd(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. Targets can be added by the ICommandBinding.AddTarget method. The created binding will be added to this CommandBindingsCollection.
Public methodAdd(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. Targets can be added by the ICommandBinding.AddTarget method. The created binding will be added to this CommandBindingsCollection.
Public methodAdd(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.
Public methodAdd(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.
Public methodAdd(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.
Public methodAddTTarget(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.
Public methodAddTEventArgs(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. Targets can be added by the ICommandBinding.AddTarget method. The created binding will be added to this CommandBindingsCollection.
Public methodAddTEventArgs(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. Targets can be added by the ICommandBinding.AddTarget method. The created binding will be added to this CommandBindingsCollection.
Public methodAddTTarget(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.
Public methodAddTEventArgs, 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.
Public methodAddTEventArgs, 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.
Public methodAddPropertyBinding(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.
Public methodAddPropertyBinding(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.
Public methodClear (Inherited from VirtualCollectionT.)
Protected methodClearItems
Removes all elements from the CommandBindingsCollection. The removed bindings will be disposed.
(Overrides FastLookupCollectionTClearItems.)
Public methodContains (Inherited from VirtualCollectionT.)
Protected methodContainsItem (Inherited from VirtualCollectionT.)
Public methodCopyTo
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.)
Public methodDispose
Releases every binding in this CommandBindingsCollection.
Protected methodDispose(Boolean)
Releases every binding in this CommandBindingsCollection.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetEnumerator
Returns an enumerator that iterates through the VirtualCollectionT.
The base implementation returns the enumerator of the underlying collection.
(Inherited from VirtualCollectionT.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Protected methodGetItem
Gets the element at the specified index.
(Inherited from FastLookupCollectionT.)
Protected methodGetItemIndex (Inherited from FastLookupCollectionT.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodIndexOf
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.)
Public methodInnerListChanged
Rebuilds the internally stored index mapping. Call if CheckConsistency is   and the internally wrapped list has been changed explicitly.
(Inherited from FastLookupCollectionT.)
Public methodInsert (Inherited from VirtualCollectionT.)
Protected methodInsertItem
Inserts a binding into the CommandBindingsCollection at the specified index.
(Overrides FastLookupCollectionTInsertItem(Int32, T).)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodOnMapRebuilt
Called after the internal index map has been rebuilt either when inconsistency has been detected or when InnerListChanged has been called.
(Inherited from FastLookupCollectionT.)
Public methodRemove (Inherited from VirtualCollectionT.)
Public methodRemoveAt (Inherited from VirtualCollectionT.)
Protected methodRemoveItem
Removes the binding at the specified index of the CommandBindingsCollection. The removed binding will be disposed.
(Overrides FastLookupCollectionTRemoveItem(Int32).)
Protected methodSetItem
Replaces the binding at the specified index. The overridden binding will be disposed.
(Overrides FastLookupCollectionTSetItem(Int32, T).)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Extension Methods

  NameDescription
Public Extension MethodConvert(Type, CultureInfo)Overloaded.
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.)
Public Extension MethodCode exampleConvertTTarget(CultureInfo)Overloaded.
Converts an Object specified in the obj parameter to the desired TTarget.
(Defined by ObjectExtensions.)
Public Extension MethodIn (Defined by ObjectExtensions.)
Public Extension MethodTryConvert(Type, Object)Overloaded.
Tries to convert an Object specified in the obj parameter to the desired targetType.
(Defined by ObjectExtensions.)
Public Extension MethodTryConvert(Type, CultureInfo, Object)Overloaded.
Tries to convert an Object specified in the obj parameter to the desired targetType.
(Defined by ObjectExtensions.)
Public Extension MethodTryConvertTTarget(TTarget)Overloaded.
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.)
Public Extension MethodTryConvertTTarget(CultureInfo, TTarget)Overloaded.
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.)
Top
See Also

Reference