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

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

3 Answers 69 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 15 Feb 2011, 10:58 PM
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

3 Answers, 1 is accepted

Sort by
0
George
Telerik team
answered on 18 Feb 2011, 03:51 PM
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
0
Ryan
Top achievements
Rank 1
answered on 18 Feb 2011, 04:11 PM
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?
0
George
Telerik team
answered on 24 Feb 2011, 11:05 AM
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!
Tags
Menu
Asked by
Ryan
Top achievements
Rank 1
Answers by
George
Telerik team
Ryan
Top achievements
Rank 1
Share this question
or