Summary
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.
Syntax
public static IDisposable BindTo<TValue, TTarget, TTValue>(this IObservable<TValue> this, TTarget target, Expression<Func<TTarget, TTValue>> property, object conversionHint = null, IBindingTypeConverter vmToViewConverterOverride = null)
where TTarget : class
Type Parameters
Name |
Description |
TValue |
The source type. |
TTarget |
The target object type. |
TTValue |
The type of the property on the target object. |
Parameters
Name |
Type |
Description |
this |
IObservable<TValue> |
The observable stream to bind to a target property. |
target |
TTarget |
The target object whose property will be set. |
property |
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 |
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 |
IDisposable |
An object that when disposed, disconnects the binding. |