Edit this page

Default Context Menu

RadTreeView displays a default context menu which appears when you right-click on a node. This menu contains 7 items and they are:

  • New: A new sibling node is created.

  • Edit: An editor appears at the position of the node from which the context menu is invoked. This editor allows you to change a property of the node.

  • Delete: The node from which the menu is invoked is deleted.

  • Expand/Collapse: Depending on the expanded state of the node, this menu item may display itself as "Expand" or "Collapse". When click the corresponding operations occurs.

  • Cut: The node from which the context menu is invoked together with its child nodes (in short - the whole branch) is cut.

  • Copy: The node from which the context menu is invoked together with its child nodes (in short - the whole branch) is copied.

  • Paste: If there a cut or copied node (branch), this node is added as a sibling node to the node from which the context menu is invoked.

Enabling the default context menu

The default context menu is not enabled by default and if you right-click a node, it will not appear on the screen. In order to enable it, you should set the AllowDefaultContextMenu property to true:

this.radTreeView1.AllowDefaultContextMenu = true;

Me.RadTreeView1.AllowDefaultContextMenu = True

treeview-context-menus-default-context-menu 001

This will display only a small subset of all available menu items. Please note that only the Expand/Collapse item is enabled. All the other items are disabled and below you will see how to enable them.

Enabling the New item

To enable the New item, you should set the AllowAdd property to true:

this.radTreeView1.AllowAdd = true;

Me.RadTreeView1.AllowAdd = True

treeview-context-menus-default-context-menu 002

Enabling the Edit item: To enable the Edit item, you should set the AllowEdit property to true:

this.radTreeView1.AllowEdit = true;

Me.RadTreeView1.AllowEdit = True

treeview-context-menus-default-context-menu 005

Enabling the Delete item: To enable the Delete item, you should set the AllowRemove property to true:

this.radTreeView1.AllowRemove = true;

Me.RadTreeView1.AllowRemove = True

treeview-context-menus-default-context-menu 004

See Also