CommandBindingsCollectionAddTEventArgs, TTarget, TParam(ActionICommandSourceTEventArgs, ICommandState, TTarget, TParam, FuncTParam, IDictionaryString, Object) Method
Namespace: KGySoft.ComponentModelAssembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 8.1.0
public ICommandBinding Add<TEventArgs, TTarget, TParam>(
Action<ICommandSource<TEventArgs>, ICommandState, TTarget, TParam> callback,
Func<TParam> getParam,
IDictionary<string, Object?>? initialState = null
)
where TEventArgs : EventArgs
Public Function Add(Of TEventArgs As EventArgs, TTarget, TParam) (
callback As Action(Of ICommandSource(Of TEventArgs), ICommandState, TTarget, TParam),
getParam As Func(Of TParam),
Optional initialState As IDictionary(Of String, Object) = Nothing
) As ICommandBinding
public:
generic<typename TEventArgs, typename TTarget, typename TParam>
where TEventArgs : EventArgs
ICommandBinding^ Add(
Action<ICommandSource<TEventArgs>^, ICommandState^, TTarget, TParam>^ callback,
Func<TParam>^ getParam,
IDictionary<String^, Object^>^ initialState = nullptr
)
member Add :
callback : Action<ICommandSource<'TEventArgs>, ICommandState, 'TTarget, 'TParam> *
getParam : Func<'TParam> *
?initialState : IDictionary<string, Object>
(* Defaults:
let _initialState = defaultArg initialState null
*)
-> ICommandBinding when 'TEventArgs : EventArgs
- callback ActionICommandSourceTEventArgs, ICommandState, 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: .
- TEventArgs
- The type of the event argument of the source events.
- 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.