Skip to main content

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

Binds the parameterized command to the CheckButton.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v26.1.dll

Declaration

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

Parameters

Name Type Description
command Object

The command.

Optional Parameters

Name Type Default Description
queryCommandParameter Func<Object> null

A Func delegate.

updateState Action<BaseButton, Func<Boolean>> null

Uses the Boolean function to specify whether the CheckButton is checked.

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 binds a command object to a CheckButton:

using DevExpress.Utils.MVVM;

var viewModel = new MyViewModel();
checkButton1.BindCommand(viewModel.ToggleCommand);
See Also