I'm using xtratreelist control from the DevExpress. I'm creating child node when user clicks on the parent node. And that time it adds the default named child node. But i want to show the cursor at the newly inserted child node for editing the child nodes text.
private void addNewGroupToolStripMenuItem_Click(object sender, EventArgs e)
{
TreeListNode childNode = treeList1.AppendNode(new object[] { "My Group" + DateTime.Now }, 1);
treeList1.FocusedNode = childNode;
treeList1.ShowEditor();
treeList1.ExpandAll();
}
I've implemented same functionality in the treeview control. By using treeview's LabelEdit property & treeView's AfterLabelEdit() method. But i'm getting these property & method in the treelist control.
whether is it possiblem? If yes then suggest some information depending on this.
thanks.
I suspect that you are using the TreeList's AppendNode method to create a new node. If so, this method returns a new TreeList node object. So, to be able to edit this node value, you should:
1) focus this node;
2) open the editor;
This can be done using the following code:
TreeListNode node = treeList.AppendNode(..);
treeList.FocusedNode = node;
treeList.ExpandAll();
treeList.ShowEditor();
UPDATE: I've modified the code and it works properly. The problem was caused by the ExpandAll method which closes the editor...