CommandBindingsCollectionAdd(ICommand, Object, String, IDictionaryString, Object, Object) Method

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.

Definition

Namespace: KGySoft.ComponentModel
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 10.0.0
C#
public ICommandBinding Add(
	ICommand command,
	Object source,
	string eventName,
	IDictionary<string, Object?>? initialState = null,
	params Object[]? targets
)

Parameters

command  ICommand
The command to bind.
source  Object
The source, which can trigger the command. Can be a Type for static events.
eventName  String
The name of the event on the source that can trigger the command.
initialState  IDictionaryString, Object  (Optional)
The initial state of the binding. This parameter is optional.
Default value: .
targets  Object
Zero or more targets for the binding.

Return Value

ICommandBinding
An ICommandBinding instance, whose State is initialized by the provided initialState and to which the specified source and targets are bound.

See Also