public virtual bool RemoveChild(TreeListNode child) { bool success = this.Children.Remove(child); if (success) { this.IsParent = this.Children.Count > 0; child.Root = child; child.Parent = null; child.ResetPath(); } return(success); }
public virtual bool AddChild(TreeListNode child) { //prevent null if (child == null) { return(false); } //prevents cycle if (IsMeOrMyAncestor(child)) { return(false); } //add new child child.Parent = this; this.Children.Add(child); child.ResetPath(); this.isParent = true; return(true); }