public override void Dispose() { this.sourceRootNode.Unobserve(); this.sourceRootNode = null; this.targetPropertyChangedWeakEventHandler.Unsubscribe(); this.targetPropertyChangedWeakEventHandler = null; this.sourceProperty = null; base.Dispose(); }
public TwoWayPropertyBinding(IPropertyBinding <TSource, TTarget, TTargetProperty> propertyBinding, Expression <Func <TSource, TSourceProperty> > sourcePropertyExpression) : base(propertyBinding) { Check.NotNull(sourcePropertyExpression, nameof(sourcePropertyExpression)); this.isBinding = false; this.sourceProperty = sourcePropertyExpression.GetBindingExpression(this.Source); this.sourceRootNode = sourcePropertyExpression.AsObservedNode(); this.sourceRootNode.Observe(this.Source, this.OnSourceChanged); this.targetPropertyChangedWeakEventHandler = this.CreateHandlerForFirstExistingEvent(this.Target, this.targetProperty.Name + "Changed", "EditingDidEnd", "ValueChanged", "Changed"); }