The recording of the first ever ReactiveUI virtual conference is available on our YouTube Channel.

PropertyBindingMixins.

Bind<TViewModel, TView, TVMProp, TVProp, TDontCare>(TView, TViewModel?, Expression<Func<TViewModel, TVMProp>>, Expression<Func<TView, TVProp>>, IObservable<TDontCare>?, object?, IBindingTypeConverter?, IBindingTypeConverter?) Method

Summary

Binds the specified view model property to the given view property, and provide a custom view update signaller to signal when the view property has been updated.
Namespace
ReactiveUI
Containing Type
PropertyBindingMixins

Syntax

public static IReactiveBinding<TView, TViewModel, (object? view, bool isViewModel)> Bind<TViewModel, TView, TVMProp, TVProp, TDontCare>(this TView view, TViewModel? viewModel, Expression<Func<TViewModel, TVMProp>> vmProperty, Expression<Func<TView, TVProp>> viewProperty, IObservable<TDontCare>? signalViewUpdate, object? conversionHint = null, IBindingTypeConverter? vmToViewConverterOverride = null, IBindingTypeConverter? viewToVMConverterOverride = null) 
    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.
TDontCare A dummy type, only the fact that signalViewUpdate emits values is considered, not the actual values emitted.

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.
signalViewUpdate IObservable<TDontCare>? An observable, that when signaled, indicates that the view property has been changed, and that the binding should update the view model property accordingly.
conversionHint object? An object that can provide a hint for the converter. The semantics of this object is defined by the converter used.
vmToViewConverterOverride IBindingTypeConverter? An optional IBindingTypeConverter to use when converting from the viewModel to view property.
viewToVMConverterOverride IBindingTypeConverter? An optional IBindingTypeConverter to use when converting from the view to viewModel property.

Return Value

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