$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
WinForms TreeView Control
Build complex navigation systems and display complex hierarchical structures
Home > WinForms UI Controls > User Manual > Editing Nodes in TreeView in C#

Editing Nodes of KetticTreeView in C#.NET

KetticTreeView WinForms control support node editing, however, this feature is disabled. To enable the node editing functionality, we shall change the value of the ApplyEditing property to be true. When we initiate the node editing feature, a text editor will be invoked to edit the node label, and then we can add text to the Text property. In addition, the developers can easily cancel the node editing through clicking the Escape. KetticTreeView control also provides two methods, StartEdit() and EndEdit(), for the users to enable and disable the editing functionality to the node selected in C# Windows Forms application.

Initiate the Editing Mode of a Node for KetticTreeView

  • To initiate the editing mode of a node, we should select the node shown on KetticTreeView and then press the F2 key
  • In the C#.NET project, we should call the StartEdit() method to initialize a new editor instance, which will be associated with the node for editing
  • And then the Editing event of the editor, as well as the Editing event of the KetticTreeView, will be fired. When canceling one of the Editing events, the editing cannot be processed.
  • After the above steps, we input value to the text box displaying to edit the node

Disable the Editing Mode of a Node for KetticTreeView

  • To disable the editing mode of node, we shall use the editor of the node in KetticTreeView
  • The editor instance performs the editing action defined to the Enter key and we can exit the editing mode
  • In the C#.NET project, we shall call the EndEdit() method to fire the ValueChanged event, so that we can apply the changes made in the session to the Text property of node.
  • After that, the ValueValidating event will be fired to hook up the custom logic for value verification. When the verification fails, the ValidationError will be fired to present a failed notification of the validation.

Custom Editors for Editing Node in KetticTreeView

KetticTreeView control allows the interface designers to use their own custom editors to edit the node text. This is achieved by replacing the default editor instance with a custom one in the EditorRequired event. The following example shows how to implement a custom node editor for KetticTreeView in C# Windows application.
  1. First, we shall derive the custom editor and element for node from the BaseTextBoxEditor and BaseTextBoxEditorElement
  2. Second, we will add a KetticDropDownListElement to the Editor element and bind the DropDownList to the data of KetticTreeView.
  3. After that, we can drag a KetticTreeView and drop it on the form, and then populate it with data and enable the custom editor
  4. Finally we implement the custom editor to display a state name of U.S. in text and the abbreviation in a drop down list

EditingMode for Update Node in KetticTreeView

KetticTreeView control provides the EditingMode within the TreeViewElement for the users to update other node when change one of them. This property contains the values as below.
  • Value, the Value will be edited as the users editing the node
  • Text, the Text will be edited as the users editing the node
  • TextAndValue, this value will change both the Text and Value as the users editing the node
UI Controlsfor Windows Forms
.NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI Design
WinForms UI Controls