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