Class CommandBinderImplementation
- Namespace
- ReactiveUI
- Assembly
- ReactiveUI.dll
Used by the CommandBinder extension methods to handle binding View controls and ViewModel commands.
- Inheritance
-
Command
Binder Implementation
- Implements
- Extension Methods
Constructors
CommandBinderImplementation()
Methods
BindCommand<TView, TViewModel, TProp, TControl, TParam>(TViewModel?, TView, Expression<Func<TViewModel, TProp?>>, Expression<Func<TView, TControl>>, IObservable<TParam?>, string?)
Bind a command from the ViewModel to an explicitly specified control on the View.
public IReactiveBinding<TView, TProp> BindCommand<TView, TViewModel, TProp, TControl, TParam>(TViewModel? viewModel, TView view, Expression<Func<TViewModel, TProp?>> vmProperty, Expression<Func<TView, TControl>> controlProperty, IObservable<TParam?> withParameter, string? toEvent = null) where TView : class, IViewFor where TViewModel : class where TProp : ICommand
Parameters
viewModel
TViewModel The View model.
view
TViewThe View.
vmProperty
Expression<Func<TViewModel, TProp>>The ViewModel command to bind.
controlProperty
Expression<Func<TView, TControl>>The name of the control on the view.
withParameter
IObservable<TParam>The ViewModel property to pass as the param of the ICommand.
toEvent
stringIf specified, bind to the specific event instead of the default. NOTE: If this parameter is used inside WhenActivated, it's important to dispose the binding when the view is deactivated.
Returns
- IReactive
Binding <TView, TProp> A class representing the binding. Dispose it to disconnect the binding.
Type Parameters
TView
The view type.
TViewModel
The view model type.
TProp
The property type.
TControl
The control type.
TParam
The parameter type.
BindCommand<TView, TViewModel, TProp, TControl, TParam>(TViewModel?, TView, Expression<Func<TViewModel, TProp?>>, Expression<Func<TView, TControl>>, Expression<Func<TViewModel, TParam?>>, string?)
Bind a command from the ViewModel to an explicitly specified control on the View.
public IReactiveBinding<TView, TProp> BindCommand<TView, TViewModel, TProp, TControl, TParam>(TViewModel? viewModel, TView view, Expression<Func<TViewModel, TProp?>> vmProperty, Expression<Func<TView, TControl>> controlProperty, Expression<Func<TViewModel, TParam?>> withParameter, string? toEvent = null) where TView : class, IViewFor where TViewModel : class where TProp : ICommand
Parameters
viewModel
TViewModel The View model.
view
TViewThe View.
vmProperty
Expression<Func<TViewModel, TProp>>The ViewModel command to bind.
controlProperty
Expression<Func<TView, TControl>>The name of the control on the view.
withParameter
Expression<Func<TViewModel, TParam>>The ViewModel property to pass as the param of the ICommand.
toEvent
stringIf specified, bind to the specific event instead of the default. NOTE: If this parameter is used inside WhenActivated, it's important to dispose the binding when the view is deactivated.
Returns
- IReactive
Binding <TView, TProp> A class representing the binding. Dispose it to disconnect the binding.
Type Parameters
TView
The view type.
TViewModel
The view model type.
TProp
The property type.
TControl
The control type.
TParam
The parameter type.
Exceptions
- Argument
Null Exception nameof(vmProperty) or nameof(vmProperty).