protected internal void RemoveLogicalChild(object child) { if (child != null) { UIElement childUIElement = child as UIElement; if (childUIElement != null && childUIElement.Parent == this) { childUIElement.ChangeLogicalParent(null); } } }
protected internal void AddLogicalChild(object child) { if (child != null) { UIElement childUIElement = child as UIElement; if (childUIElement != null) { childUIElement.ChangeLogicalParent(this); childUIElement.OnAncestorDataContextChanged(new DataContextChangedEventArgs(DataContextChangedReason.EnteringLiveTree)); } } }