This is a migrated thread and some comments may be shown as answers.

Select multiple RadContextMenu

2 Answers 131 Views
ContextMenu
This is a migrated thread and some comments may be shown as answers.
QQ
Top achievements
Rank 1
QQ asked on 10 Jun 2019, 09:34 PM

On my RadContextMenu, there are multiple RadMenuItem with CheckOnClick = True.  Is it possible to do multiple check  without the context menu closed up?  like while holding Shift button and check multiple RadMenuItem?

Thanks.

QQ

2 Answers, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 11 Jun 2019, 11:06 AM
Hello,         

When you click an item in RadContextMenu, it is expected to close the popup. In order to prevent closing it, you can simply cancel the RadContextMenu.DropDownClosing event in certain cases. Thus, you will be able to to check several menu items. Please refer to the following code snippet which result is illustrated in the attached gif file. When you click a menu item, the popup remains opened. If you need to close it, click outside the context menu: 

public RadForm1()
{
    InitializeComponent();
    RadContextMenu menu = new RadContextMenu();
    for (int i = 0; i < 10; i++)
    {
        RadMenuItem item = new RadMenuItem();
        item.CheckOnClick = true;
        item.Text = "Item" + i;
        item.MouseDown += item_MouseDown;
        item.MouseUp += item_MouseUp;
        menu.Items.Add(item);
    }
    this.radTreeView1.RadContextMenu = menu;
 
    menu.DropDownClosing += menu_DropDownClosing;
}
 
private void item_MouseUp(object sender, MouseEventArgs e)
{
    shouldCancel = false;
}
 
bool shouldCancel = true;
private void item_MouseDown(object sender, MouseEventArgs e)
{
    shouldCancel = true;
}
 
private void menu_DropDownClosing(object sender, CancelEventArgs e)
{
    e.Cancel = shouldCancel;
}
 
I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
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.
0
QQ
Top achievements
Rank 1
answered on 11 Jun 2019, 01:17 PM
Great solution.  Thanks.
Tags
ContextMenu
Asked by
QQ
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
QQ
Top achievements
Rank 1
Share this question
or