I have read you can use this to manually invoke the context menu.
this
.radGridView1.ContextMenuManager.ShowContextMenu(radGridView1.CurrentCell)
)
However, what if you want to display the menu and there are no rows? What do i pass as a parm?
Thanks,
Kim
4 Answers, 1 is accepted
0
Kim
Top achievements
Rank 1
answered on 26 Jul 2013, 11:32 PM
HI,
I found a way around this.
I found a way around this.
0
Hi Kim,
Thank you for writing.
It is good to know that you have found a solution, but keep in mind that if you are displaying the context menu with this expression in the mousedown event, both the default and yours context menus will be shown.
I hope this information helps. Should you have any other questions, I will be glad to assist you.
Regards,
Dimitar
Telerik
Thank you for writing.
It is good to know that you have found a solution, but keep in mind that if you are displaying the context menu with this expression in the mousedown event, both the default and yours context menus will be shown.
I hope this information helps. Should you have any other questions, I will be glad to assist you.
Regards,
Dimitar
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Kim
Top achievements
Rank 1
answered on 31 Jul 2013, 04:52 PM
Fyi, I use this code to determine if the user clicked on a row or not. This prevents both menus from popping up.
private void Grid_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == System.Windows.Forms.MouseButtons.Right)
{
if (gridViewDocuments.ElementTree.GetElementAtPoint(e.Location) is GridCellElement)
{
//grid will show default context menu
return;
}
//here I can show my custom menu as the grid context menu will not popup.
}
}
private void Grid_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == System.Windows.Forms.MouseButtons.Right)
{
if (gridViewDocuments.ElementTree.GetElementAtPoint(e.Location) is GridCellElement)
{
//grid will show default context menu
return;
}
//here I can show my custom menu as the grid context menu will not popup.
}
}
0
Hello Kim,
Thank you for writing back.
There is no need to show the default menu, just show your custom menu like this:
I also have prepared a small sample project to illustrate the code in action
I hope this will be useful. Should you have further questions, I would be glad to help.
Regards,
Dimitar
Telerik
Thank you for writing back.
There is no need to show the default menu, just show your custom menu like this:
if
(e.Button == System.Windows.Forms.MouseButtons.Right)
{
if
(!(radGridView1.ElementTree.GetElementAtPoint(e.Location)
is
GridCellElement))
{
// Show your custom menu here
}
}
I also have prepared a small sample project to illustrate the code in action
I hope this will be useful. Should you have further questions, I would be glad to help.
Regards,
Dimitar
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>