PropertyBindingMixins.

Bind<TViewModel, TView, TVMProp, TVProp>(TView, TViewModel, Expression<Func<TViewModel, TVMProp>>, Expression<Func<TView, TVProp>>, Func<TVMProp, TVProp>, Func<TVProp, TVMProp>) Method

Summary

Binds the specified view model property to the given view property.
Namespace
ReactiveUI
Containing Type
PropertyBindingMixins

Syntax

public static IReactiveBinding<TView, TViewModel, (object view, bool isViewModel)> Bind<TViewModel, TView, TVMProp, TVProp>(this TView view, TViewModel viewModel, Expression<Func<TViewModel, TVMProp>> vmProperty, Expression<Func<TView, TVProp>> viewProperty, Func<TVMProp, TVProp> vmToViewConverter, Func<TVProp, TVMProp> viewToVmConverter) 
    where TViewModel : class where TView : class, IViewFor

Type Parameters

Name Description
TViewModel The type of the view model being bound.
TView The type of the view being bound.
TVMProp The type of the property bound on the view model.
TVProp The type of the property bound on the view.

Parameters

Name Type Description
view TView The instance of the view to bind.
viewModel TViewModel The instance of the view model to bind.
vmProperty Expression<Func<TViewModel, TVMProp>> An expression indicating the property that is bound on the view model. This can be a chain of properties of the form.
vm => vm.Foo.Bar.Baz
and the binder will attempt to subscribe to changes on each recursively.
viewProperty Expression<Func<TView, TVProp>> The property on the view that is to be bound. This can be a chain of properties of the form.
view => view.Foo.Bar.Baz
and the binder will attempt to set the last one each time the view model property is updated.
vmToViewConverter Func<TVMProp, TVProp> Delegate to convert the value of the view model's property's type to a value of the view's property's type.
viewToVmConverter Func<TVProp, TVMProp> Delegate to convert the value of the view's property's type to a value of the view model's property's type.

Return Value

Type Description
IReactiveBinding<TView, TViewModel, (object view, bool isViewModel)> An instance of IDisposable that, when disposed, disconnects the binding.