Dynamic Formatting Demo

This sample shows how style settings can be applied dynamically.

Features

DynamicFormatting screenshot

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