CommandBindingsCollectionAddTTarget, TParam(ActionICommandState, TTarget, TParam, FuncTParam, IDictionaryString, Object) Method
Namespace: KGySoft.ComponentModelAssembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 8.1.0
public ICommandBinding Add<TTarget, TParam>(
Action<ICommandState, TTarget, TParam> callback,
Func<TParam> getParam,
IDictionary<string, Object?>? initialState = null
)
Public Function Add(Of TTarget, TParam) (
callback As Action(Of ICommandState, TTarget, TParam),
getParam As Func(Of TParam),
Optional initialState As IDictionary(Of String, Object) = Nothing
) As ICommandBinding
public:
generic<typename TTarget, typename TParam>
ICommandBinding^ Add(
Action<ICommandState^, TTarget, TParam>^ callback,
Func<TParam>^ getParam,
IDictionary<String^, Object^>^ initialState = nullptr
)
member Add :
callback : Action<ICommandState, 'TTarget, 'TParam> *
getParam : Func<'TParam> *
?initialState : IDictionary<string, Object>
(* Defaults:
let _initialState = defaultArg initialState null
*)
-> ICommandBinding
- callback ActionICommandState, TTarget, TParam
- The delegate to create the command from.
- getParam FuncTParam
- The delegate that returns the command parameter value for the callback delegate when the command is executed.
- initialState IDictionaryString, Object (Optional)
- The initial state of the binding. This parameter is optional.
Default value: .
- TTarget
- The type of the targets of the command binding.
- TParam
- The type of the command parameter.
ICommandBindingAn
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.