private void Attach() { this.Detach(); if (this.target != null && this.binding != null) { this.listener = this.GetListener(); this.listener.Attach(this.target, this.binding); } }
private BindingListener.DependencyPropertyListener GetListener() { BindingListener.DependencyPropertyListener dependencyPropertyListener; if (BindingListener.freeListeners.Count != 0) { dependencyPropertyListener = BindingListener.freeListeners[BindingListener.freeListeners.Count - 1]; BindingListener.freeListeners.RemoveAt(BindingListener.freeListeners.Count - 1); return(dependencyPropertyListener); } dependencyPropertyListener = new BindingListener.DependencyPropertyListener(); dependencyPropertyListener.Changed += new EventHandler <BindingChangedEventArgs>(this.HandleValueChanged); return(dependencyPropertyListener); }
private void ReturnListener() { this.listener.Changed -= new EventHandler<BindingChangedEventArgs>(this.HandleValueChanged); BindingListener.freeListeners.Add(this.listener); this.listener = null; }
private BindingListener.DependencyPropertyListener GetListener() { BindingListener.DependencyPropertyListener dependencyPropertyListener; if (BindingListener.freeListeners.Count != 0) { dependencyPropertyListener = BindingListener.freeListeners[BindingListener.freeListeners.Count - 1]; BindingListener.freeListeners.RemoveAt(BindingListener.freeListeners.Count - 1); return dependencyPropertyListener; } dependencyPropertyListener = new BindingListener.DependencyPropertyListener(); dependencyPropertyListener.Changed += new EventHandler<BindingChangedEventArgs>(this.HandleValueChanged); return dependencyPropertyListener; }
private void ReturnListener() { this.listener.Changed -= new EventHandler <BindingChangedEventArgs>(this.HandleValueChanged); BindingListener.freeListeners.Add(this.listener); this.listener = null; }