RadContextMenu EventName="MouseLeftButtonDown" doesn't work with SL3 DataGrid

6 posts, 0 answers
  1. Todd Millett
    Todd Millett avatar
    115 posts
    Member since:
    Jul 2009

    Posted 31 Aug 2009 Link to this post

    This may be an issue with the way the Silverlight 3 DataGrid captures mouse events, but I'm looking for a work-around if possible.

    When I hook up the RadContextMenu to a Silverlight 3 DataGrid control, if the user right-clicks on a row, the context menu displays correctly, and I am able to detect the row that was clicked on.

    However, I also want this to work on the Mac.  The right-click equivalent on a Mac (Ctrl-LeftMouseClick) does not display the RadContextMenu -- it displays the Silverlight context menu.  Therefore, I intended to detect the platform the user was running on and if it was a Mac, I would set the key sequence for the RadContextMenu to (Alt-LeftMouseClick), since (Ctrl-LeftMouseClick) doesn't work.

    I tried setting the EventName to "MouseLeftButtonDown" and the Modifier Key to ModifierKeys.Alt, but it did not work.  I tried dropping the ModifierKeys value, and it still did not work.  After much experimentation, I discovered that the "MouseLeftButtonDown" EventName does not display the ContextMenu on a Silverlight 3 DataGrid, whether on the Mac or on Windows.  Somehow the left-mouse-button-click event gets captured by the DataGrid, and never reaches the Telerik RadContextMenu control.

    Any ideas on how to solve this?  The bottom line is that I need a way to display a context menu for the DataGrid on a Mac.
  2. Todd Millett
    Todd Millett avatar
    115 posts
    Member since:
    Jul 2009

    Posted 31 Aug 2009 Link to this post

    The problem appears to be even more general than the DataGrid.  I can attach a right-click context menu to a Silverlight button, and it works fine on Windows, but not on the Mac.  While the Ctrl-LeftClick and Alt-LeftClick scenarios work in the online Demo on the Mac, they don't work when attaching the context menu to a control which already has a left-click event, such as a Button, or the DataGrid.

    While we are impressed with the capabilities of the Telerik suite so far, we do need a solution that will work both on the Mac and on Windows.  If we can't work around this, it will be a deal-killer.
  3. DevCraft banner
  4. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 02 Sep 2009 Link to this post

    Hello Todd Millett,

    We are sorry for the inconvenience caused. Unfortunately we are experiencing some problems when attaching to the right mouse click event on Mac(safari) browser. Also the current version of the RadContext menu is not catching the Click event, when it is attached to an element which handles the click event. We are planning to remove the limitation for the Q3 2009 release.

    Regards,
    Kaloyan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Todd Millett
    Todd Millett avatar
    115 posts
    Member since:
    Jul 2009

    Posted 02 Sep 2009 Link to this post

    Thanks for your response.  I look forward to the fix.  Ideally, for us, the Ctrl-LeftMouseClick would work on the Mac (in Safari or Firefox), since that is the experience that most Mac users would expect.
  6. Doug
    Doug avatar
    22 posts
    Member since:
    Apr 2009

    Posted 14 Jul 2011 Link to this post

     

    <Telerik:RadContextMenu.ContextMenu>
        <Telerik:RadContextMenu x:Name="MyContextMenu" EventName="MouseLeftButtonDown"

    FYI- this still doesn't work, I'm attaching it to a button but also tried a border - no joy.

     

     

  7. Hristo
    Admin
    Hristo avatar
    832 posts

    Posted 15 Jul 2011 Link to this post

    Hello Doug,

    We are not aware of such bug.
    In order to work when EventName is MouseLeftButtonDown you should set AttachOnHandledEvents=true.
    This is needed because Button is handling MouseLeftButtonDown and when this property is true we will also mange to handle it.
    As for the border it should work if the border have background (when there is no background then mouse events are not fired).

    Kind 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!

Back to Top
DevCraft banner