Articles in this section
Category / Section

How to apply row styles to the WinForms GridGroupingControl?

1 min read

Row style

There is no RowStyles property in the GridGroupingControl similar to the GridControl. You can apply styles to a row by using the QueryCellStyleInfo event. Set the e.Style property there when the e.TableCellIdentity points to the Record that you want to set the style on.

C#

//Event triggering.
this.gridGroupingControl1.QueryCellStyleInfo += gridGroupingControl1_QueryCellStyleInfo;
void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
   // Applies style to the second record row.
   int recordindex =this.gridGroupingControl1.TableControl.TopRowIndex + 1;
   if(e.TableCellIdentity.RowIndex==recordindex)
   {
      e.Style.ReadOnly = true;
      e.Style.BackColor = Color.LightCoral;
   }
}

VB

'Event triggering.
Private Me.gridGroupingControl1.QueryCellStyleInfo += AddressOf gridGroupingControl1_QueryCellStyleInfo
Private Sub gridGroupingControl1_QueryCellStyleInfo(ByVal sender As Object, ByVal e As GridTableCellStyleInfoEventArgs)
   'Applies style to the second record row. 
   Dim recordindex As Integer =Me.gridGroupingControl1.TableControl.TopRowIndex + 1
   If e.TableCellIdentity.RowIndex=recordindex Then
      e.Style.ReadOnly = True
      e.Style.BackColor = Color.LightCoral
   End If
End Sub

The output is displayed as follows:

Row style applied to the second row of the record

Samples:

C#: RowStyle-C#

VB: RowStyle-VB

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