We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to highlight a GroupHeader section when the GroupHeader is clicked in WinForms GridGroupingControl?

Platform: WinForms |
Control: GridGroupingControl |
Published Date: April 30, 2011 |
Last Revised Date: February 13, 2020

Highlight the group header

You can highlight a GroupHeader section when the group header is clicked by using TableControlCellClick event. You can check if the selection is a GroupCaptionCell and can highlight the GroupHeader.

C#

void gridGroupingControl1_TableControlCellClick(object sender, GridTableControlCellClickEventArgs e)
{
   GridTableCellStyleInfo style = e.TableControl.Model[e.Inner.RowIndex, e.Inner.ColIndex];
   if(style.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionCell)
   {
      e.TableControl.Selections.Add(GridRangeInfo.Row(e.Inner.RowIndex));
      Console.WriteLine("Header clicked");
   }
}

VB

Private Sub gridGroupingControl1_TableControlCellClick(ByVal sender As Object, ByVal e As GridTableControlCellClickEventArgs)
   Dim style As GridTableCellStyleInfo = e.TableControl.Model(e.Inner.RowIndex, e.Inner.ColIndex)
   If style.TableCellIdentity.TableCellType = GridTableCellType.GroupCaptionCell Then
      e.TableControl.Selections.Add(GridRangeInfo.Row(e.Inner.RowIndex))
      Console.WriteLine("Header clicked")
   End If
End Sub

Screenshot

Highlight the group header

Samples:

C#: GroupHeader-C#

VB: GroupHeader-VB

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon