Completed
Last Updated: 02 Jun 2014 12:47 by ADMIN
ADMIN
Dimitar
Created on: 21 May 2014 12:13
Category: TreeView
Type: Bug Report
1
FIX. RadTreeView - the Copy, Cut and Paste items cannot be removed from the default context menu.
To reproduce:
- Add RadTreeView to a blank form.
- Set its AllowDragDrop and AllowDefaultContextMenu properties to true.
- Clear the menu items in the  ContextMenuOpening event.
- You will notice that the Copy, Cut and Paste items are not removed.

Workaround:
 void radTreeView1_ContextMenuOpening(object sender, Telerik.WinControls.UI.TreeViewContextMenuOpeningEventArgs e)
{
   
    e.Menu.DropDownOpened -= Menu_DropDownOpened; 
    e.Menu.DropDownOpened += Menu_DropDownOpened; 
}

void Menu_DropDownOpened(object sender, EventArgs e)
{
    TreeViewDefaultContextMenu Menu = sender as TreeViewDefaultContextMenu;

    for (int i = Menu.Items.Count - 1; i >= 0; i--)
    {
        if (Menu.Items[i].Name == "Copy" || Menu.Items[i].Name == "Cut" || Menu.Items[i].Name == "Paste")
        {
            Menu.Items.Remove(Menu.Items[i]);
        }
    }
}
0 comments