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
80
UltraTree - error while set the first node of tree be invisible
posted

my application requires refreshing nodes in ultra tree. I want to remove or hide some nodes with specific attributes. One of the deleted nodes is the first node added to the tree.

If I set that node visible = false I get the following error:

"The ActiveNode can only be set to a node that belongs to this control."

If I try to remove that node, I get error:

"Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index"

Here is my code:

- Create a new UltraTree with name ultraTree1

 void createTree()
        {
            //the following code causes problem
            ultraTree1.BeginUpdate();

            ultraTree1.Nodes.Clear();
            ultraTree1.Focus();

            UltraTreeNode _n1 = ultraTree1.Nodes.Add("node 1");

            UltraTreeNode _n2 = ultraTree1.Nodes.Add("node 2");

            ultraTree1.ActiveNode = null;
           
            //_n1.Visible = false;
            _n1.Remove();
           
            //the code causing problem
            ultraTree1.EndUpdate();
        }

and the main class:

 public Form1()
        {
            InitializeComponent();

            createTree();//works ok
        
            createTree(); //get error
        }

 

I found out that BeginUpdate() and EndUpdate() cause these errors. It works ok if I comment out BeginUpdate() and EndUpdate(). However, I want to use these methods because my tree has considerable large number of nodes.

Do you have any hot fix for that issue ???

I use Infragistics 9.1

 

 

Parents Reply Children
No Data