CheckButton.BindCommand<T>(Expression<Action<T>>, Object, Func<T>, Action<BaseButton, Func<Boolean>>) Method
Uses the command selector to find an appropriate parameterized command of the target type 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<T>(
Expression<Action<T>> commandSelector,
object source,
Func<T> queryCommandParameter = null,
Action<BaseButton, Func<bool>> updateState = null
)
Parameters
| Name | Type | Description |
|---|---|---|
| commandSelector | Expression<Action<T>> | An Expression that selects the appropriate command from the source object. |
| source | Object | An Object (typically, a ViewModel) where the commandSelector looks for the required command. |
Optional Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| queryCommandParameter | Func<T> | null | A Func delegate that passes the specific Object to the command as a parameter. |
| updateState | Action<BaseButton, Func<Boolean>> | null | Specifies whether the |
Type Parameters
| Name | Description |
|---|---|
| T | The type of a ViewModel that stores a bindable command. |
Returns
| Type | Description |
|---|---|
| IDisposable | An IDisposable object. Disposing of this object unbinds the command from the |
Remarks
BindCommand<T> supports the WinForms MVVM pattern. Refer to the following help topic for additional information: Commands.
The following code snippet binds a typed ViewModel command to a CheckButton:
using DevExpress.Utils.MVVM;
var fluent = MVVMContext.OfType<MyViewModel>(mvvmContext);
fluent.BindCommand<MyViewModel>(checkButton1, vm => vm.ToggleCommand());