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

How to collapse RadContextMenu when RadMenuItem doesn't receive click?

2 Answers 139 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Rob
Top achievements
Rank 1
Rob asked on 30 Jun 2010, 02:23 PM
I am working on a control that is basically a dropdown with a popup content area...  The attached picture can explain it better than I can here. 

I have started using ToggleButton with a RadContextMenu and it seems to work well.  I think my ultimate goal would be to simply have a giant ContentPresenter in the popup instead of using a RadContextMenu...  Until I figure that out, I can hack each RadMenuItem using a TemplateSelector and choose a different appearance for each one that will get me closer to my goal...

That being said, I have one problem.  How can I "close" the popup when something other than the RadMenuItem receives the click event... for example if I click the Button "option 1"?  The context menu works fine if I click the RadMenuItem itself.

2 Answers, 1 is accepted

Sort by
0
Accepted
Hristo
Telerik team
answered on 02 Jul 2010, 09:18 AM
Hi Rob,

Button control handles MouseLeftButton Up/Down events. That is why RadMenuItem does not receive them and didn't close.
There is no easy and clean way to handle this situation. Change the Button to some other control that doesn't handle Up/Down events and RadContextMenu will close.

I hope this will help you.

Sincerely yours,
Hristo
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
troy
Top achievements
Rank 1
answered on 28 Jul 2010, 05:01 PM

I figured out how to accomplish basically the same thing with this...

Troy

 

 

 

void btnclose_Click(object sender, RoutedEventArgs e)

 

{

 

 

RadContextMenu cm = (RadContextMenu)((Button)sender).Parent;

 

cm.IsOpen =

 

false;

 

}

Tags
Menu
Asked by
Rob
Top achievements
Rank 1
Answers by
Hristo
Telerik team
troy
Top achievements
Rank 1
Share this question
or