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

PropertyBindingMixins.

OneWayBind<TViewModel, TView, TVMProp, TVProp>(TView, TViewModel, Expression<Func<TViewModel, TVMProp>>, Expression<Func<TView, TVProp>>, object, IBindingTypeConverter) Method

Summary

Binds the given property on the view model to a given property on the view in a one-way (view model to view) fashion.
Namespace
ReactiveUI
Containing Type
PropertyBindingMixins

Syntax

public static IReactiveBinding<TView, TVProp> OneWayBind<TViewModel, TView, TVMProp, TVProp>(this TView view, TViewModel viewModel, Expression<Func<TViewModel, TVMProp>> vmProperty, Expression<Func<TView, TVProp>> viewProperty, object conversionHint = null, IBindingTypeConverter vmToViewConverterOverride = null) 
    where TViewModel : class where TView : class, IViewFor

Type Parameters

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

Parameters

Name Type Description
view TView The instance of the view object which is bound. Usually, it is the. this instance.
viewModel TViewModel The view model that is bound. It is usually set to the ViewModel property of the view.
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.
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.

Return Value

Type Description
IReactiveBinding<TView, TVProp> An instance of IDisposable that, when disposed, disconnects the binding.