Hi Ryan
In a GridGroupingControl, you cannot set any row specific or cell specific properties like backcolor. To do this, you will have to catch the TableControlPrepareViewStyleInfo event (or QueryCellStyleInfo event). In the event handler code, you can check for the e. TableCellIdentity .RowIndex and if that points to the row you wanted, set the e.Style.BackColor to the color you want.
void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell)
{
//Apply colours row wise.
if (e.TableCellIdentity.RowIndex % 2 == 0)
{
e.Style.BackColor = Color.Pink;
}
//Color for particular cell alone
if (e.TableCellIdentity.ColIndex == 1)
{
Element el = e.TableCellIdentity.DisplayElement;
if (el != null && el.Kind == DisplayElementKind.Record)
{
Record r = el.GetRecord();
object value = r.GetValue("sno");
int s = (int)value;
if (s == 3)
e.Style.BackColor = Color.Blue;
}
}
}
}
Please try the attached sample and let me know if this helps.
sample:
CustomColor.zipBest Regards,
S.Shyam.