},System.Linq.Expressions.Expression{System.Func{--0,--3}},System.String,System.String,System.String,System.String,System.Int32)} },System.Linq.Expressions.Expression{System.Func{--0,--3}},System.IObservable{--4},System.String,System.String,System.String,System.String,System.Int32)} },System.Linq.Expressions.Expression{System.Func{--0,--3}},System.Linq.Expressions.Expression{System.Func{--1,--4}},System.String,System.String,System.String,System.String,System.String,System.Int32)}
ReactiveUIBindingExtensions.BindCommand(TView, TViewModel?, Expression>, Expression>, string?, string, string, string, int) method¶
Defined in
Type: ReactiveUIBindingExtensions
Namespace: ReactiveUI.Binding
Assembly: ReactiveUI.Binding.dll
Applies to
net10.0, net10.0-browserwasm1.0, net10.0-desktop1.0, net9.0, net9.0-browserwasm1.0, net9.0-desktop1.0, net8.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.2, net8.0-macos14.5, net8.0-tvos17.2, netstandard2.1, net462, net481
Overloads¶
- 1.
public static IDisposable BindCommand<TView, TViewModel, TProp, TControl>(this TView view, TViewModel? viewModel, Expression<Func<TViewModel, TProp?>> propertyName, Expression<Func<TView, TControl>> controlName, string? toEvent = null, string propertyNameExpression = "", string controlNameExpression = "", string callerFilePath = "", int callerLineNumber = 0) where TView : class, IViewFor where TViewModel : class where TProp : ICommand where TControl : class - 2.
public static IDisposable BindCommand<TView, TViewModel, TProp, TControl, TParam>(this TView view, TViewModel? viewModel, Expression<Func<TViewModel, TProp?>> propertyName, Expression<Func<TView, TControl>> controlName, IObservable<TParam?> withParameter, string? toEvent = null, string propertyNameExpression = "", string controlNameExpression = "", string callerFilePath = "", int callerLineNumber = 0) where TView : class, IViewFor where TViewModel : class where TProp : ICommand where TControl : class - 3.
public static IDisposable BindCommand<TView, TViewModel, TProp, TControl, TParam>(this TView view, TViewModel? viewModel, Expression<Func<TViewModel, TProp?>> propertyName, Expression<Func<TView, TControl>> controlName, Expression<Func<TViewModel, TParam?>> withParameter, string? toEvent = null, string propertyNameExpression = "", string controlNameExpression = "", string withParameterExpression = "", string callerFilePath = "", int callerLineNumber = 0) where TView : class, IViewFor where TViewModel : class where TProp : ICommand where TControl : class
1. Overload¶
public static IDisposable BindCommand<TView, TViewModel, TProp, TControl>(this TView view, TViewModel? viewModel, Expression<Func<TViewModel, TProp?>> propertyName, Expression<Func<TView, TControl>> controlName, string? toEvent = null, string propertyNameExpression = "", string controlNameExpression = "", string callerFilePath = "", int callerLineNumber = 0) where TView : class, IViewFor where TViewModel : class where TProp : ICommand where TControl : class
Summary: Binds a command from a view model to a control on a view.
Type parameters
| Name | Description |
|---|---|
TView | The type of the view. |
TViewModel | The type of the view model. |
TProp | The type of the command property. |
TControl | The type of the control. |
Parameters
| Name | Type | Description |
|---|---|---|
view | TView | The view to bind to. |
viewModel | TViewModel? | The view model containing the command. |
propertyName | Expression | An expression that selects the command property on the view model. |
controlName | Expression | An expression that selects the control on the view. |
toEvent = null | string? | The event name to bind to. If null, a default event is selected. |
propertyNameExpression = "" | string | The caller argument expression for propertyName. Auto-populated by the compiler. |
controlNameExpression = "" | string | The caller argument expression for controlName. Auto-populated by the compiler. |
callerFilePath = "" | string | The source file path of the caller. Auto-populated by the compiler. |
callerLineNumber = 0 | int | The source line number of the caller. Auto-populated by the compiler. |
Returns: IDisposable -- A disposable that, when disposed, disconnects the binding.
2. Overload¶
public static IDisposable BindCommand<TView, TViewModel, TProp, TControl, TParam>(this TView view, TViewModel? viewModel, Expression<Func<TViewModel, TProp?>> propertyName, Expression<Func<TView, TControl>> controlName, IObservable<TParam?> withParameter, string? toEvent = null, string propertyNameExpression = "", string controlNameExpression = "", string callerFilePath = "", int callerLineNumber = 0) where TView : class, IViewFor where TViewModel : class where TProp : ICommand where TControl : class
Summary: Binds a command from a view model to a control on a view with an observable parameter.
Type parameters
| Name | Description |
|---|---|
TView | The type of the view. |
TViewModel | The type of the view model. |
TProp | The type of the command property. |
TControl | The type of the control. |
TParam | The type of the command parameter. |
Parameters
| Name | Type | Description |
|---|---|---|
view | TView | The view to bind to. |
viewModel | TViewModel? | The view model containing the command. |
propertyName | Expression | An expression that selects the command property on the view model. |
controlName | Expression | An expression that selects the control on the view. |
withParameter | IObservable | An observable that provides the command parameter. |
toEvent = null | string? | The event name to bind to. If null, a default event is selected. |
propertyNameExpression = "" | string | The caller argument expression for propertyName. Auto-populated by the compiler. |
controlNameExpression = "" | string | The caller argument expression for controlName. Auto-populated by the compiler. |
callerFilePath = "" | string | The source file path of the caller. Auto-populated by the compiler. |
callerLineNumber = 0 | int | The source line number of the caller. Auto-populated by the compiler. |
Returns: IDisposable -- A disposable that, when disposed, disconnects the binding.
3. Overload¶
public static IDisposable BindCommand<TView, TViewModel, TProp, TControl, TParam>(this TView view, TViewModel? viewModel, Expression<Func<TViewModel, TProp?>> propertyName, Expression<Func<TView, TControl>> controlName, Expression<Func<TViewModel, TParam?>> withParameter, string? toEvent = null, string propertyNameExpression = "", string controlNameExpression = "", string withParameterExpression = "", string callerFilePath = "", int callerLineNumber = 0) where TView : class, IViewFor where TViewModel : class where TProp : ICommand where TControl : class
Summary: Binds a command from a view model to a control on a view with a parameter expression.
Type parameters
| Name | Description |
|---|---|
TView | The type of the view. |
TViewModel | The type of the view model. |
TProp | The type of the command property. |
TControl | The type of the control. |
TParam | The type of the command parameter. |
Parameters
| Name | Type | Description |
|---|---|---|
view | TView | The view to bind to. |
viewModel | TViewModel? | The view model containing the command. |
propertyName | Expression | An expression that selects the command property on the view model. |
controlName | Expression | An expression that selects the control on the view. |
withParameter | Expression | An expression that selects the command parameter property on the view model. |
toEvent = null | string? | The event name to bind to. If null, a default event is selected. |
propertyNameExpression = "" | string | The caller argument expression for propertyName. Auto-populated by the compiler. |
controlNameExpression = "" | string | The caller argument expression for controlName. Auto-populated by the compiler. |
withParameterExpression = "" | string | The caller argument expression for withParameter. Auto-populated by the compiler. |
callerFilePath = "" | string | The source file path of the caller. Auto-populated by the compiler. |
callerLineNumber = 0 | int | The source line number of the caller. Auto-populated by the compiler. |
Returns: IDisposable -- A disposable that, when disposed, disconnects the binding.