this.gridGroupingControl1.TableControl.SupportsPrepareViewStyleInfo = false;
private void GridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity == null || e.TableCellIdentity.Column == null)
return;
GridCurrentCell currentCell = this.gridGroupingControl1.TableControl.CurrentCell;
if (e.TableCellIdentity.DisplayElement.Kind == Syncfusion.Grouping.DisplayElementKind.Record)
{
if (e.TableCellIdentity.Column.Name == "Name" && e.TableCellIdentity.RowIndex % 3 == 0)
{
e.Style.BackColor = Color.Yellow;
e.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.Yellow);
}
else if (e.TableCellIdentity.DisplayElement.GetRecord().IsSelected()
&& currentCell.ColIndex != e.TableCellIdentity.ColIndex)
{
//To set the backcolor for selected records
e.Style.BackColor = this.gridGroupingControl1.TableOptions.SelectionBackColor;
e.Style.TextColor = Color.White;
}
}
} |