Disable Context Menu on Selected Item

2 posts, 0 answers
  1. Pelli
    Pelli avatar
    11 posts
    Member since:
    May 2014

    Posted 11 Jun 2015 Link to this post


     We have a radtreeview with check boxes. Now we want to support radcontextmenu on checked items and dragdrop on selected items. But when we implement context menu , we are getting even on selected item.

    How can we disable contextmenu on selected item and enable only if it checked. Please provide your inputs.



  2. Martin Ivanov
    Martin Ivanov avatar
    2360 posts

    Posted 12 Jun 2015 Link to this post

    Hello Subhashini,

    You can prevent the context menu from opening by handling the ContextMenuOpening event of the element on which the menu is attached. For example, if the context menu is attached on the RadTreeView control you can subscribe for its event and set the argument's Handled property to True. Here is an example:
    <telerik:RadTreeView ContextMenuOpening="RadTreeView_ContextMenuOpening">
                <!-- menu items -->

    private void RadTreeView_ContextMenuOpening(object sender, ContextMenuEventArgs e)
        if(the item is selected and is not checked)
            e.Handled = true;           

    Please try this approach and let me know if it works for you.

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top