Is it possible to have multiple RadContextMenu objects on one DataGridView?

4 posts, 0 answers
  1. Ryan
    Ryan avatar
    18 posts
    Member since:
    Oct 2010

    Posted 15 Feb 2011 Link to this post

    Hello,

    Here's my situation. I have a datagridview which is bound to a custom object. When the users left click on most of the cells they see a customized RadContextMenu that allows them to modify values and submit those changes to the custom object and then through a web service to a database. 

    However, there are a few cells that they need to be able to copy the value from. I'd like a more standard right click ContextMenu to appear on those cells, but it appears that the RadGridView can only handle one ContexMenu bound to it. I could do the right click at a higher level (the window or usercontrol that the gridview is a child of) but then the right clicks would function anywhere instead of specific cells, and I'm not sure how to get the content of the cells if I'm not opening the contextmenu within the gridview.

    Thanks,

    Ryan Brown
  2. George
    Admin
    George avatar
    1332 posts

    Posted 18 Feb 2011 Link to this post

    Hi Ryan,

     
    Unfortunately, this behavior is not supported out of the box. I would suggest you to open explicitly the RadContextMenu. You could handle the MouseLeftButtonUp and MouseRightButtonDown events. In the handlers, you could get the RadContextMenu using the following code:

    RadContextMenu menu = RadContextMenu.GetContextMenu(sender as FrameworkElement);

     and add your custom logic. I hope this helps.


    Best wishes,
    George
    the Telerik team
  3. DevCraft banner
  4. Ryan
    Ryan avatar
    18 posts
    Member since:
    Oct 2010

    Posted 18 Feb 2011 Link to this post

    How exactly would I get down to the event handlers for the RadContextMenu? Is this a template level change, or something in a source code file somewhere?
  5. George
    Admin
    George avatar
    1332 posts

    Posted 24 Feb 2011 Link to this post

    Hi Ryan,

    Attached you can find a sample. You could modify it in order to suit your needs. 

    Best wishes,
    George
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Back to Top