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.
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 5.3.0
public static ICommandBinding CreateBinding( this ICommand command, IDictionary<string, Object> initialState = null, bool disposeCommand = false )
<ExtensionAttribute> Public Shared Function CreateBinding ( command As ICommand, Optional initialState As IDictionary(Of String, Object) = Nothing, Optional disposeCommand As Boolean = false ) As ICommandBinding
public: [ExtensionAttribute] static ICommandBinding^ CreateBinding( ICommand^ command, IDictionary<String^, Object^>^ initialState = nullptr, bool disposeCommand = false )
[<ExtensionAttribute>] static member CreateBinding : command : ICommand * ?initialState : IDictionary<string, Object> * ?disposeCommand : bool (* Defaults: let _initialState = defaultArg initialState null let _disposeCommand = defaultArg disposeCommand false *) -> ICommandBinding
- Type: KGySoft.ComponentModelICommand
The command to bind.
- initialState (Optional)
- Type: System.Collections.GenericIDictionaryString, Object
The initial state of the binding.
- disposeCommand (Optional)
- Type: SystemBoolean
to dispose the possibly disposable command when the returned ICommandBinding is disposed; to keep the command alive when the returned ICommandBinding is disposed. Use only if the command will not be re-used elsewhere. This parameter is optional.
Default value: .
Return ValueType: ICommandBinding
An ICommandBinding instance, whose State is initialized by the provided initialState. To make the command invokable by this binding, at least one source must be added by the AddSource method on the result. Targets can be added by the AddTarget method on the result.
Usage NoteIn 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).