This sample shows how style settings can be applied dynamically.
Provide formatting at run time using the QueryCellStyleInfo event handler.
QueryCellStyleInfo provides the GridStyleInfo object for a given cell on demand.
This is the event that is fired every time a request is made to access the style information of a cell.
It is also used to conditionally change the style for a given cell.
Inside this handler, you can apply style settings for a given cell type by using the GridTableCellStyleInfoEventArgs.TableCellIdentity.TableCellType property.
Here is a sample code snippet that applies different styles to grid cells.
private void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e) { if(e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell) { if(e.TableCellIdentity.ColIndex %2 ==0) { e.Style.Font.FontStyle=FontStyle.Bold; e.Style.BackColor=Color.FromArgb(255, 187, 111); } else { e.Style.TextColor = Color.White; e.Style.BackColor=Color.FromArgb(55, 91, 114); } } else if( e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell) { if(e.TableCellIdentity.ColIndex%2==0) { e.Style.Font.FontStyle=FontStyle.Underline; e.Style.BackColor=Color.FromArgb(0, 21, 84); e.Style.TextColor = Color.White; } else { e.Style.BackColor=Color.FromArgb(255, 188, 112); e.Style.Font.FontStyle=FontStyle.Italic; } } }