I have looked at the samples explorer and the online docs. and still am having no luck inserting a node at a location. Since the nodes are not uniquely indexed how do you insert at index? If I select a node three levels down it might have an index of 0 which causes the node to insert at the root level.
A node is synoymous with a file location; just as the path to a given file is unique, so is the "path" to each node. To say a node is "n levels down" does not provide enough information to unambiguously distinguish that node from all others, just as to say "a file is n sub-folders down" is not enough information. You have to provide the index of each node in each level, so the minimum of information required would be an array of indices. For example, given the array, [0, 1, 2, 3, 4], it being implied that the index of each number in the array represents the level, you would have this:
this.ultraTree1.Nodes[0].Nodes[1].Nodes[2].Nodes[3].Nodes[4];
Obviously an index-driven approach is difficult to maintain, which is why the control supports keyed Nodes collections. You give each node a key that is unique across all Nodes collections, and you can then access that node using the control's GetNodeByKey method. Using the file system analogy, you would assign the full path to the file as the node's key, for example, "Windows\System\shell.dll".
So could you show me a sample of how to get the information and write the code to insert? If my node is n levels down and n = 10 how do I know how far down and how do I construct a nodes.nodes.nodes.nodes........ statement dynamically?
Each island of nodes (meaning nodes that share the same parent) are indexed independently.
If you want to insert a new node three levels down in the tree, you should first get the index of the root node under which your new node would go, then the index of the second-level node under which your new node will go, and then insert your new node to that Nodes collection.
For instance, to insert "newNode" to the fourth position under the first child of the second parent:
ultraTree1.Nodes[1].Nodes[0].Insert(3,newNode);