internal void Unapply() { object sourceObject; if (_weakSource != null && _weakSource.TryGetTarget(out sourceObject)) { for (var i = 0; i < _parts.Count - 1; i++) { BindingExpressionPart part = _parts[i]; if (!part.IsSelf) { part.TryGetValue(sourceObject, out sourceObject); } part.Unsubscribe(); } } if (_trackingTemplatedParent) { BindableObject target = null; if (_weakTarget?.TryGetTarget(out target) == true && target is Element elem) { elem.TemplatedParentChanged -= OnTargetTemplatedParentChanged; } } _weakSource = null; _weakTarget = null; ClearAncestryChangeSubscriptions(); }
internal void Unapply() { object sourceObject; if (_weakSource != null && _weakSource.TryGetTarget(out sourceObject)) { for (var i = 0; i < _parts.Count - 1; i++) { BindingExpressionPart part = _parts[i]; if (!part.IsSelf) { part.TryGetValue(sourceObject, out sourceObject); } part.Unsubscribe(); } } _weakSource = null; _weakTarget = null; }