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]);
}
}
}