Interface IPropertyBinderImplementation
- Namespace
- ReactiveUI
- Assembly
- ReactiveUI.dll
This interface represents an object that is capable of providing binding implementations.
public interface IPropertyBinderImplementation : IEnableLogger
Methods
BindTo<TValue, TTarget, TTValue>(IObservable<TValue>, TTarget?, Expression<Func<TTarget, TTValue?>>, object?, IBindingTypeConverter?)
BindTo takes an Observable stream and applies it to a target property. Conceptually it is similar to.
Subscribe(x =>
target.property = x)
, but allows you to use child properties
without the null checks.
IDisposable BindTo<TValue, TTarget, TTValue>(IObservable<TValue> observedChange, TTarget? target, Expression<Func<TTarget, TTValue?>> propertyExpression, object? conversionHint, IBindingTypeConverter? vmToViewConverterOverride = null) where TTarget : class
Parameters
observedChange
IObservable<TValue>The target observable to bind to.
target
TTargetThe target object whose property will be set.
propertyExpression
Expression<Func<TTarget, TTValue>>An expression representing the target property to set. This can be a child property (i.e.
x.Foo.Bar.Baz
).conversionHint
objectAn object that can provide a hint for the converter. The semantics of this object is defined by the converter used.
vmToViewConverterOverride
IBindingTypeConverterAn optional IBindingTypeConverter to use when converting from the viewModel to view property.
Returns
- IDisposable
An object that when disposed, disconnects the binding.
Type Parameters
TValue
The value type.
TTarget
The target type.
TTValue
The target value type.
Bind<TViewModel, TView, TVMProp, TVProp, TDontCare>(TViewModel?, TView, Expression<Func<TViewModel, TVMProp?>>, Expression<Func<TView, TVProp>>, IObservable<TDontCare>?, Func<TVMProp?, TVProp>, Func<TVProp, TVMProp?>, TriggerUpdate)
Creates a two-way binding between a view model and a view. This binding will attempt to convert the values of the view and view model properties using a IBindingTypeConverter if they are not of the same type.
IReactiveBinding<TView, (object? view, bool isViewModel)> Bind<TViewModel, TView, TVMProp, TVProp, TDontCare>(TViewModel? viewModel, TView view, Expression<Func<TViewModel, TVMProp?>> vmProperty, Expression<Func<TView, TVProp>> viewProperty, IObservable<TDontCare>? signalViewUpdate, Func<TVMProp?, TVProp> vmToViewConverter, Func<TVProp, TVMProp?> viewToVmConverter, TriggerUpdate triggerUpdate = TriggerUpdate.ViewToViewModel) where TViewModel : class where TView : class, IViewFor
Parameters
viewModel
TViewModelThe instance of the view model object to be bound.
view
TViewThe instance of the view object to be bound.
vmProperty
Expression<Func<TViewModel, TVMProp>>An expression representing the property to be bound to on the view model. This can be a child property, for example
x => x.Foo.Bar.Baz
in which case the binding will attempt to subscribe recursively to updates in order to always get and set the correct property.viewProperty
Expression<Func<TView, TVProp>>An expression representing the property to be bound to on the view. This can be a child property, for example
x => x.Foo.Bar.Baz
in which case the binding will attempt to subscribe recursively to updates in order to always get and set the correct property.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.
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.
triggerUpdate
TriggerUpdateThe trigger update direction.
Returns
- IReactiveBinding<TView, (object view, bool isViewModel)>
An instance of IDisposable that, when disposed, disconnects the binding.
Type Parameters
TViewModel
The type of the view model that is 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.
Bind<TViewModel, TView, TVMProp, TVProp, TDontCare>(TViewModel?, TView, Expression<Func<TViewModel, TVMProp?>>, Expression<Func<TView, TVProp>>, IObservable<TDontCare>?, object?, IBindingTypeConverter?, IBindingTypeConverter?, TriggerUpdate)
Creates a two-way binding between a view model and a view. This binding will attempt to convert the values of the view and view model properties using a IBindingTypeConverter if they are not of the same type.
IReactiveBinding<TView, (object? view, bool isViewModel)> Bind<TViewModel, TView, TVMProp, TVProp, TDontCare>(TViewModel? viewModel, TView view, Expression<Func<TViewModel, TVMProp?>> vmProperty, Expression<Func<TView, TVProp>> viewProperty, IObservable<TDontCare>? signalViewUpdate, object? conversionHint, IBindingTypeConverter? vmToViewConverterOverride = null, IBindingTypeConverter? viewToVMConverterOverride = null, TriggerUpdate triggerUpdate = TriggerUpdate.ViewToViewModel) where TViewModel : class where TView : class, IViewFor
Parameters
viewModel
TViewModelThe instance of the view model object to be bound.
view
TViewThe instance of the view object to be bound.
vmProperty
Expression<Func<TViewModel, TVMProp>>An expression representing the property to be bound to on the view model. This can be a child property, for example
x => x.Foo.Bar.Baz
in which case the binding will attempt to subscribe recursively to updates in order to always get and set the correct property.viewProperty
Expression<Func<TView, TVProp>>An expression representing the property to be bound to on the view. This can be a child property, for example
x => x.Foo.Bar.Baz
in which case the binding will attempt to subscribe recursively to updates in order to always get and set the correct property.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
objectAn object that can provide a hint for the converter. The semantics of this object is defined by the converter used.
vmToViewConverterOverride
IBindingTypeConverterAn optional IBindingTypeConverter to use when converting from the viewModel to view property.
viewToVMConverterOverride
IBindingTypeConverterAn optional IBindingTypeConverter to use when converting from the view to viewModel property.
triggerUpdate
TriggerUpdateThe trigger update direction.
Returns
- IReactiveBinding<TView, (object view, bool isViewModel)>
An instance of IDisposable that, when disposed, disconnects the binding.
Type Parameters
TViewModel
The type of the view model that is 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.
OneWayBind<TViewModel, TView, TProp, TOut>(TViewModel?, TView, Expression<Func<TViewModel, TProp?>>, Expression<Func<TView, TOut>>, Func<TProp, TOut>)
Creates a one way binding with a selector, i.e. a binding that flows from the
viewModel
to the view
only, and where the value of the view model
property is mapped through the selector
before being set to the view.
IReactiveBinding<TView, TOut> OneWayBind<TViewModel, TView, TProp, TOut>(TViewModel? viewModel, TView view, Expression<Func<TViewModel, TProp?>> vmProperty, Expression<Func<TView, TOut>> viewProperty, Func<TProp, TOut> selector) where TViewModel : class where TView : class, IViewFor
Parameters
viewModel
TViewModelThe instance of the view model to bind to.
view
TViewThe instance of the view to bind to.
vmProperty
Expression<Func<TViewModel, TProp>>An expression representing the property to be bound to on the view model. This can be a child property, for example
x => x.Foo.Bar.Baz
in which case the binding will attempt to subscribe recursively to updates in order to always get the last value of the property chain.viewProperty
Expression<Func<TView, TOut>>An expression representing the property to be bound to on the view. This can be a child property, for example
x => x.Foo.Bar.Baz
in which case the binding will attempt to subscribe recursively to updates in order to always set the correct property.selector
Func<TProp, TOut>A function that will be used to transform the values of the property on the view model before being bound to the view property.
Returns
- IReactiveBinding<TView, TOut>
An instance of IDisposable that, when disposed, disconnects the binding.
Type Parameters
TViewModel
The type of the view model that is bound.
TView
The type of the view that is bound.
TProp
The type of the property bound on the view model.
TOut
The return type of the
selector
.
OneWayBind<TViewModel, TView, TVMProp, TVProp>(TViewModel?, TView, Expression<Func<TViewModel, TVMProp?>>, Expression<Func<TView, TVProp>>, object?, IBindingTypeConverter?)
Creates a one-way binding, i.e. a binding that flows from the
viewModel
to the view
only. This binding will
attempt to convert the value of the view model property to the view property if they
are not of the same type.
IReactiveBinding<TView, TVProp> OneWayBind<TViewModel, TView, TVMProp, TVProp>(TViewModel? viewModel, TView view, Expression<Func<TViewModel, TVMProp?>> vmProperty, Expression<Func<TView, TVProp>> viewProperty, object? conversionHint, IBindingTypeConverter? vmToViewConverterOverride = null) where TViewModel : class where TView : class, IViewFor
Parameters
viewModel
TViewModelThe instance of the view model to bind to.
view
TViewThe instance of the view to bind to.
vmProperty
Expression<Func<TViewModel, TVMProp>>An expression representing the property to be bound to on the view model. This can be a child property, for example
x => x.Foo.Bar.Baz
in which case the binding will attempt to subscribe recursively to updates in order to always get the last value of the property chain.viewProperty
Expression<Func<TView, TVProp>>An expression representing the property to be bound to on the view. This can be a child property, for example
x => x.Foo.Bar.Baz
in which case the binding will attempt to subscribe recursively to updates in order to always set the correct property.conversionHint
objectAn object that can provide a hint for the converter. The semantics of this object is defined by the converter used.
vmToViewConverterOverride
IBindingTypeConverterAn optional IBindingTypeConverter to use when converting from the viewModel to view property.
Returns
- IReactiveBinding<TView, TVProp>
An instance of IDisposable that, when disposed, disconnects the binding.
Type Parameters
TViewModel
The type of the view model that is bound.
TView
The type of the view that is bound.
TVMProp
The type of the property bound on the view model.
TVProp
The type of the property bound on the view.
Exceptions
- ArgumentException
There is no registered converter from
TVMProp
toTVProp
.