I've added parent node at runtime as
TreeListNode parentNode1 = treeList1.AppendNode(new object[] { "BuiltIn Groups"}, null);
But now i want to insert child node under particular parent node. In my application when user right click on particular parent node then i shown a menu & when user selects to insert new child node under selected parent node then i used the same treeList1.AppendNode()
method but this method require second parameter as p开发者_StackOverflow中文版arent node index & i'm getting that parent node index when i insert parent node at run time.
Can u suggest something about this issue?
thanks.
If you want to insert a new child under the current selected node:
TreeNode parent = treeView.SelectedNode;
if (parent != null)
{
treeList1.AppendNode(..., parent);
}
The following code should work for you:
TreeListNode parentNode = treeList1.AppendNode(..., null);
TreeListNode childNode = treeList1.AppendNode(..., parentNode);
精彩评论