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

Custom Context Menu when clicking outside of a cell?

2 Answers 72 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Lou
Top achievements
Rank 1
Lou asked on 14 Apr 2015, 05:52 PM

Hi,

How do I get a custom context menu to be shown when clicking in a GridView outside of a cell? For example, if there are only a few rows and I click near the bottom of the control? 

-Lou

2 Answers, 1 is accepted

Sort by
0
Ralitsa
Telerik team
answered on 17 Apr 2015, 07:53 AM
Hi Lou,

Thank you for contacting us. 

You can subscribe to the MouseDown event and show the custom context menu. Please refer to the following code snippet: 
void radGridView1_MouseDown(object sender, MouseEventArgs e)
{
    if (e.Button == System.Windows.Forms.MouseButtons.Right)
    {
        if (this.radGridView1.FocusedElement is GridTableElement)
        {
            radContextMenu1.Show(this.radGridView1.PointToScreen(e.Location));
        }
    }
}

More information how to customize the default context menu of the RadGridView can be found in the article GridView >> Context Menus

I have also attached a sample project which demonstrates the implementation. 

Should you have further questions, I would be glad to help.


Regards,
Ralitsa
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Lou
Top achievements
Rank 1
answered on 17 Apr 2015, 01:34 PM

Great - thanks that was very helpful.

 -Lou

Tags
GridView
Asked by
Lou
Top achievements
Rank 1
Answers by
Ralitsa
Telerik team
Lou
Top achievements
Rank 1
Share this question
or