ContextMenu Take one click to close

3 posts, 0 answers
  1. Nikhil
    Nikhil avatar
    11 posts
    Member since:
    Apr 2011

    Posted 19 Jul 2011 Link to this post

    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. Hristo
    Admin
    Hristo avatar
    832 posts

    Posted 20 Jul 2011 Link to this post

    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!

  3. DevCraft banner
  4. Nikhil
    Nikhil avatar
    11 posts
    Member since:
    Apr 2011

    Posted 20 Jul 2011 Link to this post

    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
Back to Top