ICommandBindingWithParameter Method

Specifies a callback to obtain the command parameter value for the underlying ICommand. It is evaluated once whenever a source event is triggered. If this ICommandBinding has multiple targets, the ICommand.Execute method is invoked with the same parameter value for each target.

Definition

Namespace: KGySoft.ComponentModel
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 10.0.0
C#
ICommandBinding WithParameter(
	Func<Object?>? getParameterValue
)

Parameters

getParameterValue  FuncObject
A function, which returns the parameter value before the underlying ICommand is executed.

Return Value

ICommandBinding
This ICommandBinding instance to provide fluent initialization.

Remarks

  Note

Calling the WithParameter method multiple times on the same ICommandBinding instance just overwrites the lastly set callback function. To use more parameter values the function should return a compound type such as an array or tuple.

  Tip

It is recommended to specify the parameter callback before adding any sources to avoid the possible issues if there is any chance that the source can be triggered before completing the initialization.

See Also