I have a c# app in which I would like to allow the user to enter new nodes in a TreeView control without having to use the mouse.
I am able to intercept keystrokes in OnKeyDown, and the following code is working successfully:
TreeNode newNode = new TreeNode( e.KeyData.ToString() );
LabelEdit = true;
The problem is that the first letter in the node being edited is selected, which causes the following keystroke to replace the selected character. Typing "HELLO" results in "ELLO", unless the user first presses the right-arrow key to deselect the selected
I tried setting e.Node.IsSelected = false in OnBeforeLabelEdit, but cannot because the IsSelected property is read-only.
How can I programatically deselect the first character and position the edit cursor after the first character?
View Complete Post