Skip to main content

CheckButton.BindCommand(Expression<Action>, Object, Func<Object>, Action<BaseButton, Func<Boolean>>) Method

Uses the command selector to find an appropriate parameterized command in the source and bind it to the CheckButton.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v25.2.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

public override IDisposable BindCommand(
    Expression<Action> commandSelector,
    object source,
    Func<object> queryCommandParameter = null,
    Action<BaseButton, Func<bool>> updateState = null
)

Parameters

Name Type Description
commandSelector Expression<Action>

Selects the appropriate command from the source object.

source Object

The source.

Optional Parameters

Name Type Default Description
queryCommandParameter Func<Object> null

A Func delegate.

updateState Action<BaseButton, Func<Boolean>> null

An Action that specifies whether the CheckButton is currently enabled.

Returns

Type Description
IDisposable

An IDisposable object. Disposing of this object unbinds the command from the CheckButton.

Remarks

BindCommand supports the WinForms MVVM pattern. Refer to the following help topic for additional information: Commands.

The following code snippet uses a command selector to bind a ViewModel command to a CheckButton:

using DevExpress.Utils.MVVM;

var fluent = MVVMContext.OfType<MyViewModel>(mvvmContext);
fluent.BindCommand(checkButton1, vm => vm.SaveCommand());
See Also