ContextMenu swallowing all mouse events

2 posts, 0 answers
  1. Kevin
    Kevin avatar
    30 posts
    Member since:
    Jul 2012

    Posted 06 May 2011 Link to this post

    I need to use the ContextMenu in a way that allows me to also respond to a right click event on the item.

    The application is a diagram based UI, where there are many items on a canvas.  When an item is right clicked, it should be selected first, then the contextmenu should open.

    I am using the telerik method to adding a mouse handler :
    Mouse.AddMouseDownHandler(componentArtBoard, componentArtboard_MouseDown, true);

    Note that I am using it for the mouse DOWN.  On the same UIElement (componentArtboard), I have a RadContextMenu defined, with EventName set to 'MouseRightButtonUp'.

    When I right click, the context menu somehow swallows the mouse down event, even though it is set to respond to MouseRightButtonUp.  Even more confusing is that the Mouse.AddMouseDownHandler above is set to also catch handled events.

    I am at a loss here.  Is this a bug?
  2. Hristo
    Hristo avatar
    832 posts

    Posted 09 May 2011 Link to this post

    Hello Kevin,

    When we open RadContextMenu we add one additional Popup under the context menu which handles mousedown event and close radcontextmenu. We do this because there is no other way to know when user clicked outside context menu (which we need to know so that we can close the context menu).

    This is why your code is not called - routed events does not go through Popups.

    Once the platform is improved we will remove this popup. Until then I can recommend you is to manually open the context menu (e.g. create Popup and set its Child to be RadContextMenu and instead of RadContextMenu.IsOpen set popup.IsOpen=true).
    This way you will have to manually close the menu and also you will have to manually implement boundary detection.

    I hope that this is acceptable for you.

    Kind regards,
    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
Back to Top