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

ContextMenu Take one click to close

2 Answers 96 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Nikhil
Top achievements
Rank 1
Nikhil asked on 19 Jul 2011, 02:51 PM
Hi,

I used RadContextMenu in my application. I am showing this menu on Mouse Right Button Down event on Listbox items. The context menu is displayed properly on first attempt but if it is open and i click on another list box item, the event handler is not getting triggered and hence context menu is not displayed. It seems it takes the second click as an internal event handler to automatically close the context menu. So for every alternate attempt it takes two clicks to open the menu. Please help me in resolving this as we have to put this feature in production release in couple of days.

Regards,
Nikhil

2 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 20 Jul 2011, 07:10 AM
Hello Nikhil,

When RadContextMenu opens we open a additional popup that is used to catch the clicks outside context menu so that we can close it. This is the only possible way of doing it because in Silverlight there is no CaptureMouse(subtree) method.
This is the default behavior and cannot be changed.

One possible solution is to use Popup and to show it manually (e.g. instead RadContextMenu.IsOpen=true, popup.Child = radContextMenu, popup.IsOpen=True) but you will have to manually implement boundary detection and open/close of the popup.

Regards,
Hristo
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Nikhil
Top achievements
Rank 1
answered on 20 Jul 2011, 07:20 AM
I have found a work arround to tackle this problem. I changed the context menu display event to MouseRightButtonUp and added a check to close the existing opened context menu on MouseRightButtonDown event. It works exactly as per my requirement.

Regards,
Nikhil
Tags
Menu
Asked by
Nikhil
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Nikhil
Top achievements
Rank 1
Share this question
or