Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
490
How to remove a node and all of its children from an UltraTree
posted

I tried with several versions of this clean method, but couldn't succeed to remove all the child nodes of the node that I want to remove.

private void Clean(UltraTreeNode node)
        {
            while (node.Nodes.Count > 0)
            {
                this.Clean(node.Nodes[0]);
            }
            node.Remove();
            if (this.NavigationTree.Nodes.Contains(node))
                this.NavigationTree.Nodes.Remove(node);

        }

When I want to add a new node with the same key as a node that I think to be cleaned, I still get key already exists exception.