RadTreeView ContextMenu for certain nodes only

2 posts, 1 answers
  1. Daica
    Daica avatar
    4 posts
    Member since:
    Mar 2019

    Posted 11 Mar 2019 Link to this post


    I am wondering if it is possible to set a RadContextMenu for certain nodes when creating them programmatically.

    For example, my tree will look something like this:




    [MAIN NODE 2]




    Would it be possible to have a RadContextMenu only for the parent node, and then a separate RadContextMenu for all the Child nodes?


  2. Answer
    Dess | Tech Support Engineer, Sr.
    Dess | Tech Support Engineer, Sr.  avatar
    3759 posts

    Posted 12 Mar 2019 Link to this post

    Hello, Daica,    

    In order to restrict the context menu showing, it is appropriate to cancel the RadTreeView.ContextMenuOpening event considering the Node.Level in the TreeViewContextMenuOpeningEventArgs. This property indicates whether the node is a parent one or a sub node:

    public RadForm1()
        this.radTreeView1.AllowDefaultContextMenu = true;
    private void radTreeView1_ContextMenuOpening(object sender, Telerik.WinControls.UI.TreeViewContextMenuOpeningEventArgs e)
        if (e.Node.Level!=0)
            e.Cancel = true;

    Additional information about the context menu in RadTreeView is available in the online documentation:


    I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

    Dess | Tech Support Engineer, Sr.
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top