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

RadContextMenu - prevent auto close when clicking item

3 Answers 301 Views
ContextMenu
This is a migrated thread and some comments may be shown as answers.
Dzh
Top achievements
Rank 1
Dzh asked on 19 Mar 2014, 06:32 PM
Hi!

How to prevent auto close of RadContextMenu when user clicks on item on it? Now, after mouse click on any item, it closes. In WinForms there is ContextMenuStrip.AutoClose property to prevent autoclosing. Is there analogue of the property on Telerik RadContextMenu?

Thanks,

3 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 24 Mar 2014, 12:51 PM
Hello Dzh,

Thank you for writing.

We do not have such а property, but you can very easily prevent the menu from closing by using the DropDownClosing event:
void menu_DropDownClosing(object sender, CancelEventArgs e)
{
    e.Cancel = true;
}

I hope this will be useful. Should you have further questions, I would be glad to help.

Regards,
Dimitar
Telerik

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
0
Dzh
Top achievements
Rank 1
answered on 17 Apr 2014, 08:57 AM
Thank you! But could you tell me how to close RadContextMenu programmatically, when I click anywhere outside the menu?
0
Dimitar
Telerik team
answered on 17 Apr 2014, 03:29 PM
Hi Dzh,

Thank you for writing back.

This can be done by just checking if the context menu contains the mouse and cancel the close only if it does:
void menu_DropDownClosing(object sender, CancelEventArgs e)
{
  
    if (menu.DropDown.Bounds.Contains(MousePosition))
    {
        e.Cancel = true;
    }
}

Please let me know if there is something else I can help you with. 
 
Regards,
Dimitar
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
ContextMenu
Asked by
Dzh
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Dzh
Top achievements
Rank 1
Share this question
or