Custom Context Menu when clicking outside of a cell?

3 posts, 0 answers
  1. Lou
    Lou avatar
    61 posts
    Member since:
    Aug 2014

    Posted 14 Apr 2015 Link to this post

    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. Ralitsa
    Admin
    Ralitsa avatar
    176 posts

    Posted 17 Apr 2015 Link to this post

    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.

     
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Lou
    Lou avatar
    61 posts
    Member since:
    Aug 2014

    Posted 17 Apr 2015 in reply to Ralitsa Link to this post

    Great - thanks that was very helpful.

     -Lou

Back to Top