$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 > Context Menu in TreeView in C#

Context Menu of KetticTreeView in C#.NET

KetticTreeView control supports the context menu for nodes. This control contains default context menu for the users to easily display menu on the node in tree view. The default menu can be shown by a simple right click on the node where you are going to add a menu. In addition, the KetticTreeView WinForms control also supports custom context menu. In this C# tutorial, we are going through the process of working with the default context menu in TreeView.

Items for Using Context Menu in TreeView

The default context menu of KetticTreeView node contains several items for the users to work with it. To show a context menu, we can simply right click the node of TreeView. The following are the context menu items.
  • New, this item of the context menu is able to create a new node in TreeView
  • Delete, this item is capable of removing a node where the context menu is invoked
  • Edit, this item is used to display an editor of context menu invoked on a node and the users can modify the properties of the node via the editor
  • Expand and Collapse, this item is able to expand or collapse the context menu item on a node
  • Copy, it is used to copy the parent node as well as their child node from the invoked context menu
  • Paste, it is able to paste the node copied or cut to another node
  • Cut, it is able to cut the parent node as well as their child node from the invoked context menu

C# Enable Context Menu for TreeView Node

KetticTreeView control doesn't enable the context menu by default. To enable this functionality, we need to change the value of the ApplyContextMenu to be true as the C# code snippet below.

this.ketticTreeView1.ApplyContextMenu = true;
When we enable the context menu functionality, the menu items mentioned above aren't simultaneously enabled besides the Expand and Collapse. We should enable these context menu items one by one and the following C# code snippets demonstrate how to achieve this.

C# Enable New Item of Context Menu in TreeView Node

KetticTreeView control includes the EnableAdd property for the users to enable the New Item of context menu for tree view node. The C# code snippet below shows how to achieve this.

this.ketticTreeView1.EnableAdd = true;

C# Enable Context Menu Edit Item of TreeView Node

KetticTreeView contains the EnableEdit property for the users to enable the menu Edit Item for tree view node. The C# code snippet below shows how to achieve this.

this.ketticTreeView1.EnableEdit = true;

C# Enable Menu Delete Item of TreeView Node

KetticTreeView contains the EnableRemove property for the users to enable the menu Remove Item for tree view node. The C# code snippet below shows how to achieve this.

this.ketticTreeView1.EnableRemove = true;
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