예제 #1
0
        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);
        }
예제 #2
0
        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);
        }