/// <summary> /// Initialites a two-way bind between <see cref="PerspexProperty"/>s. /// </summary> /// <param name="property">The property on this object.</param> /// <param name="source">The source object.</param> /// <param name="sourceProperty">The property on the source object.</param> /// <returns> /// A disposable which can be used to terminate the binding. /// </returns> /// <remarks> /// The binding is first carried out from <paramref name="source"/> to this. Two-way /// bindings are always at the LocalValue priority. /// </remarks> public void BindTwoWay( PerspexProperty property, PerspexObject source, PerspexProperty sourceProperty) { source.GetObservable(sourceProperty).Subscribe(x => this.SetValue(property, x)); this.GetObservable(property).Subscribe(x => source.SetValue(sourceProperty, x)); }
/// <summary> /// Initialites a two-way bind between <see cref="PerspexProperty"/>s. /// </summary> /// <param name="property">The property on this object.</param> /// <param name="source">The source object.</param> /// <param name="sourceProperty">The property on the source object.</param> /// <param name="priority">The priority of the binding.</param> /// <returns> /// A disposable which can be used to terminate the binding. /// </returns> /// <remarks> /// The binding is first carried out from <paramref name="source"/> to this. /// </remarks> public IDisposable BindTwoWay( PerspexProperty property, PerspexObject source, PerspexProperty sourceProperty, BindingPriority priority = BindingPriority.LocalValue) { return(new CompositeDisposable( Bind(property, source.GetObservable(sourceProperty)), source.Bind(sourceProperty, GetObservable(property)))); }
/// <summary> /// Initiates a two-way binding between <see cref="PerspexProperty"/>s. /// </summary> /// <param name="property">The property on this object.</param> /// <param name="source">The source object.</param> /// <param name="sourceProperty">The property on the source object.</param> /// <param name="priority">The priority of the binding.</param> /// <returns> /// A disposable which can be used to terminate the binding. /// </returns> /// <remarks> /// The binding is first carried out from <paramref name="source"/> to this. /// </remarks> public IDisposable BindTwoWay( PerspexProperty property, PerspexObject source, PerspexProperty sourceProperty, BindingPriority priority = BindingPriority.LocalValue) { VerifyAccess(); _propertyLog.Verbose( "Bound two way {Property} to {Binding} with priority {Priority}", property, source, priority); return(new CompositeDisposable( Bind(property, source.GetObservable(sourceProperty)), source.Bind(sourceProperty, GetObservable(property)))); }