Articles in this section

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

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.


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");
   }
}
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

The screenshot below displays the highlighting of the group header in GGC.


Highlight the group header


Samples
:

C#: GroupHeader-C#

VB: GroupHeader-VB

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied