/// <summary> /// Removes a visual child from this object. /// </summary> /// <param name="child">The child object to remove from this object.</param> protected internal void RemoveVisualChild(Visual child) { if (child == null || child.visualParent == null) { return; } if (child.visualParent == this) { child.visualParent = null; child.OnVisualParentChangedInternal(this, null); } }
/// <summary> /// Adds a visual as a child of this object. /// </summary> /// <param name="child">The child object to add to this object.</param> protected internal void AddVisualChild(Visual child) { if (child == null) { return; } if (child.visualParent != null) { throw new InvalidOperationException(PresentationStrings.VisualAlreadyHasAParent); } if (child.visualParent != this) { var oldParent = child.visualParent; var newParent = this; child.visualParent = newParent; child.OnVisualParentChangedInternal(oldParent, newParent); } }
/// <summary> /// Removes a visual child from this object. /// </summary> /// <param name="child">The child object to remove from this object.</param> protected internal void RemoveVisualChild(Visual child) { if (child == null || child.visualParent == null) return; if (child.visualParent == this) { child.visualParent = null; child.OnVisualParentChangedInternal(this, null); } }
/// <summary> /// Adds a visual as a child of this object. /// </summary> /// <param name="child">The child object to add to this object.</param> protected internal void AddVisualChild(Visual child) { if (child == null) return; if (child.visualParent != null) throw new InvalidOperationException(PresentationStrings.VisualAlreadyHasAParent); if (child.visualParent != this) { var oldParent = child.visualParent; var newParent = this; child.visualParent = newParent; child.OnVisualParentChangedInternal(oldParent, newParent); } }