$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
KetticTreeView Control for Windows Forms
Build complex navigation systems and display complex hierarchical structures
Home > WinForms UI Controls > User Manual > Build Context Menu at Design Time in C#

Add Context Menu to Tree View in C#.NET

While using the KetticTreeView control, we can easily add context menus to it, as well as a single node of KetticTreeView. The context menu for KetticTreeView nodes takes precedence over the menu. To add the context menu to KetticTreeView control for Windows Forms, we can simply drag and drop the KetticContextMenu component to the Windows Form that we are designing. At the same time, a KetticContextMenuManager will be created and a KetticContextMenu property will be added to the KetticTreeView control. We are able to customize the KetticContextMenu instance via the property.

Add and Customize Context Menu for KetticTreeView in C#.NET

To add and customize the context menu to KetticTreeView, we can assign a KetticContextMenu instance to a single node through the KetticTreeView Property Builder. The following steps show how to achieve this.
  1. Open an existing .NET project or create a new one in your Visual Studio
  2. Drag KetticTreeView control and a KetticContextMenu control from the toolbox and drop them on the form
  3. Add a few KetticMenuItems to the KetticContextMenu component on the form
  4. Open the Smart Tag of the KetticContextMenu instance, create a KetticContextMenuManager through clicking the Add ContextMenuManager from the Action Menu
  5. After that, the KetticContextMenu property will be available for the KetticTreeView instance. And set the KetticContextMenu property to the KetticContextMenu instance
  6. Drag the KetticContextMenu component to create a new instance and add a few KetticMenuItems to the instance
  7. Add another KetticContextMenu to the desired nodes via the ContextMenu property in the KetticTreeView Property Builder
  8. Run the .NET Window project to check the added context menu to KetticTreeView

Show Predefined Context Menu on KetticTreeView

KetticTreeView WinForms control contains a predefined context menu. By default setting, the context menu is hidden. To show it, we can enable the ApplyPredefinedContextMenu property. The following items are included in the predefined context menu of KetticTreeView
  • Edit, this item is able to enable the editor for the current node in tree view
  • Expand, this item is used to expand the current node in tree view
  • Collapse, this item is used to collapse the current node in tree view
  • New, this item is able to create a new instance for the current node in tree view
  • Delete, this item is used to remove the current node in tree view
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