Hi Vincent,
Thanks for using Syncfusion products.
By default, when Selection mode is enabled, the default SelectionBackColor will override the cells BackColor for selection. If you want to avoid this overriding of SelectionBackColor, then the TableControlDrawCellDisplayText event can be used. Please make use of the below code,
Code Example
//Event Subscription.
this.gridGroupingControl1.TableControlDrawCellDisplayText += new GridTableControlDrawCellDisplayTextEventHandler(gridGroupingControl1_TableControlDrawCellDisplayText);
void gridGroupingControl1_TableControlDrawCellDisplayText(object sender, GridTableControlDrawCellDisplayTextEventArgs e)
{
GridTableCellStyleInfo style = e.Inner.Style as GridTableCellStyleInfo;
if (style != null && style.TableCellIdentity != null && style.TableCellIdentity.DisplayElement != null
&& style.TableCellIdentity.DisplayElement.GetRecord() != null && style.TableCellIdentity.Column != null)
{
Record record = style.TableCellIdentity.DisplayElement.GetRecord();
string value = record["Gender"].ToString();
if (record.IsSelected())
{
if (value == "Male" && style.TableCellIdentity.Column.Name == "Name")
{
e.Inner.Graphics.FillRectangle(new SolidBrush(Color.Blue), e.Inner.TextRectangle);
}
else if (style.TableCellIdentity.Column.Name == "Name")
{
e.Inner.Graphics.FillRectangle(new SolidBrush(Color.Pink), e.Inner.TextRectangle);
}
}
}
}
Sample Link
Regards,
Amal Raj U.