Hello,
I found a great example of setting the top node in hopes that after running the code that topnode that i set on the ultraTreeView would actually scroll to the top.
I can see in the debugger that I correctly set the property but it still somehow scrolls all the way to the top.
Heres the code I use. Do I need to refresh or do anything else to get this to work? Any help would be great. Thanks
public void RebuildTree() { UltraTreeNode topNode = ultraTreeView1.GetNodeByKey(_TopNodeKey); // Load the tree PopulateDesignAltsTreeNode(); // Process all context events DoAllContextEvents(); if (topNode != null) ultraTreeView1.TopNode = topNode; }
Hi,
I don't know what the methods you have here are doing. But the first one is pretty suspicious.
My first guess, just from looking at the name of the method, is that this method is re-populating the tree. It's probably removing all of the nodes from this tree and adding new nodes. Which means that the topNode variable you stored is referring to a node that is no longer a part of this tree. You probably need to call GetNodeByKey after you populate the tree. Assuming that the tree was populated with a node that has the same key, it should work.
Thanks Mike!
It didnt occur to me for whatever reason that I was trying to retrieve the node before the tree was rebuilt.
This works for me now!