/// <summary> /// Removes a child from this element. /// </summary> /// <param name="child">The element to be unparented.</param> public void RemoveChild(UIElement child) { if (Children.Contains(child)) { if (!ToRemove.Contains(child)) { ToRemove.Add(child); } } else if (ToAdd.Contains(child)) { ToAdd.Remove(child); } else { throw new Exception("Tried to remove a child that does not belong to this element!"); } }
/// <summary> /// Checks if this element has the specified child. /// </summary> /// <param name="element">The possible child.</param> /// <returns></returns> public bool HasChild(UIElement element) { return(Children.Contains(element) && !ToRemove.Contains(element)); }