CommandBinderImplementation.

BindCommand<TView, TViewModel, TProp, TControl, TParam>(TViewModel, TView, Expression<Func<TViewModel, TProp>>, Expression<Func<TView, TControl>>, Func<TParam>, string) Method

Summary

Bind a command from the ViewModel to an explicitly specified control on the View.
Namespace
ReactiveUI
Containing Type
CommandBinderImplementation

Syntax

public IReactiveBinding<TView, TViewModel, TProp> BindCommand<TView, TViewModel, TProp, TControl, TParam>(TViewModel viewModel, TView view, Expression<Func<TViewModel, TProp>> vmProperty, Expression<Func<TView, TControl>> controlProperty, Func<TParam> withParameter, string toEvent = null) 
    where TView : class, IViewFor<TViewModel> where TViewModel : class where TProp : ICommand

Type Parameters

Name Description
TView The view type.
TViewModel The view model type.
TProp The property type.
TControl The control type.
TParam The parameter type.

Parameters

Name Type Description
viewModel TViewModel The View model.
view TView The 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 Func<TParam> The ViewModel property to pass as the param of the ICommand.
toEvent string If 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.

Return Value

Type Description
IReactiveBinding<TView, TViewModel, TProp> A class representing the binding. Dispose it to disconnect the binding.