Interface IReactiveBinding<TView, TValue>
- Namespace
- ReactiveUI
- Assembly
- ReactiveUI.dll
This interface represents the result of a Bind/OneWayBind and gives information about the binding. When this object is disposed, it will destroy the binding it is describing (i.e. most of the time you won't actually care about this object, just that it is disposable).
public interface IReactiveBinding<out TView, out TValue> : IDisposable where TView : IViewFor
Type Parameters
TViewThe view type.
TValueThe value type.
- Inherited Members
- Extension Methods
Examples
var binding = this.Bind(ViewModel, vm => vm.UserName, v => v.UserNameTextBox.Text);
binding.Changed.Subscribe(value => logger.LogInformation("UserName changed to {Value}", value));
// Later
binding.Dispose();
Remarks
IReactiveBinding<TView, TValue> instances are returned from helpers like Bind,
OneWayBind, and BindCommand. Holding onto the binding allows you to inspect the original
property expressions, observe the Changed stream, or dispose the binding manually when a
different lifecycle than WhenActivated is required.
Properties
Changed
Gets an observable representing changed values for the binding.
IObservable<out TValue?> Changed { get; }
Property Value
- IObservable<TValue>
Direction
Gets the direction of the binding.
BindingDirection Direction { get; }
Property Value
View
Gets the instance of the view this binding is applied to.
TView View { get; }
Property Value
- TView
ViewExpression
Gets an expression representing the property on the view bound to the ViewModel. This can be a child property, for example x.Foo.Bar.Baz in which case that will be the expression.
Expression ViewExpression { get; }
Property Value
ViewModelExpression
Gets an expression representing the property on the ViewModel bound to the view. This can be a child property, for example x.Foo.Bar.Baz in which case that will be the expression.
Expression ViewModelExpression { get; }