How to attach a context menu to the Windows Forms GridGroupingControl

15 Jun 20211 minute to read

This can be done using the code snippet below.

  • C#
  • //Adds items to context menu.
    this.contextMenu1.MenuItems.Add("One");
    this.contextMenu1.MenuItems.Add("Two");
    this.contextMenu1.MenuItems.Add("Three");
    
    //Assigns it to the GridGroupingControl.
    this.gridGroupingControl1.ContextMenu = this.contextMenu1;
  • VB
  • 'Adds items to context menu.
    Me.contextMenu1.MenuItems.Add("One")
    Me.contextMenu1.MenuItems.Add("Two")
    Me.contextMenu1.MenuItems.Add("Three")
    
    'Assigns it to the GridGroupingControl.
    Me.gridGroupingControl1.ContextMenu = Me.contextMenu1