We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Up and Down Arrows in Edit Mode of Treeview Are Disabled

Is it possible to be able to use the up and down arrow keys to scroll through the treeview control while in edit mode. I simply want to be able to scroll through every node on the tree and have each node come up in edit mode as I hit the up and down arrow keys. When you leave the node, then the edit mode would be turned off. Unfortunately, there is no way of turning off and then turning on edit mode programmatically as you scroll thorugh the tree using the up and down arrows because the node label does not allow you to trap the keypress nor keydown events in .NET. You always have to either hit ''Enter'' or click on another node to get out of edit mode. Can someone help me?

1 Reply

VS Vijayanand S Syncfusion Team September 26, 2005 10:45 AM UTC

Hi Tim, You could navigate through the nodes in the TreeViewAdv control using the keyboard while in editing mode, by using the following code snippet: private void treeViewAdv1_BeforeEdit(object sender, Syncfusion.Windows.Forms.Tools.TreeNodeAdvBeforeEditEventArgs e) { //TempNode is the Holder of the current editing node TempNode=e.Node; TextBox t=e.TextBox; //KeyEventHandler to handle the Keys pressed in Text box t.KeyDown+=new KeyEventHandler(t_KeyDown); } private void t_KeyDown(object sender, KeyEventArgs e) { TextBox t=sender as TextBox; if(e.KeyData==Keys.Down) { //To Stop the editing this.treeViewAdv1.EndEdit(true); //To replace the edited contents into the selected node. TempNode.Text=t.Text; //End the event e.Handled=true; } } You could also start the node editing dynamically by using, this.treeViewAdv1.BeginEdit() method. Please take a look at the attached sample and let me know if this fulfills your requirement. Thanks for using Syncfusion products. Regards, Vijay f35181_6405.zip

Loader.
Live Chat Icon For mobile
Up arrow icon