public override void Dispose() { lock (_syncObj) { Detach(); if (_bindingDependency != null) { _bindingDependency.Detach(); _bindingDependency = null; } // Child bindings will be disposed automatically by DependencyObject.Dispose, because they are // added to our binding collection (was done by method AddChild) ResetBindingAttachments(); base.Dispose(); } }
public void Dispose(bool passSourceToContextObject) { Detach(); if (_bindingDependency != null) { _bindingDependency.Detach(); _bindingDependency = null; } ResetChangeHandlerAttachments(); MPF.TryCleanupAndDispose(_valueConverter); object source = Source; if (passSourceToContextObject && source != null) { _contextObject.TakeOverOwnership(source); } else { MPF.TryCleanupAndDispose(source); } base.Dispose(); }