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

KGy SOFT Core Libraries Help
Creates a binding for a command using the specified source, eventName and targets as well as the optionally provided initial state of the binding.

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

public static ICommandBinding CreateBinding(
	this ICommand command,
	Object source,
	string eventName,
	IDictionary<string, Object?>? initialState = null,
	params Object[]? targets


Type: KGySoft.ComponentModelICommand
The command to bind.
Type: SystemObject
The source, which can trigger the command. Can be a Type for static events.
Type: SystemString
The name of the event on the source that can trigger the command.
initialState (Optional)
Type: System.Collections.GenericIDictionaryString, Object
The initial state of the binding.
Type: SystemObject
Zero or more targets for the binding.

Return Value

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

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ICommand. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also