Don''t hightlight cell when selecting rows

I have a GridControl with ListBoxSelectionMode = SelectionMode.MultiExtended
When selecting rows the current cell (the cell the user clicks on) does not get the selection colour, and remains white.

Is there a way to turn this off, so the whole row gets highlighted when it is selected?

1 Reply

CI Christopher Issac Sunder K Syncfusion Team June 23, 2010 02:22 PM UTC

Hi Stephen,

Thank you for your interest in Syncfusion products.

Highlighting the selected row including current cell can be achieved by handling the PrepareViewStyleInfo event. In the given sample, the AlphaBlendSelectionColor property gives us the selection color.

this.gridControl1.ListBoxSelectionMode = SelectionMode.MultiExtended;
this.gridControl1.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(gridControl1_PrepareViewStyleInfo);
this.gridControl1.ActivateCurrentCellBehavior = GridCellActivateAction.DblClickOnCell; //

void gridControl1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
GridCurrentCell cc = this.gridControl1.CurrentCell;
if (e.RowIndex == cc.RowIndex && e.ColIndex == cc.ColIndex && !cc.IsEditing)
{
e.Style.BackColor = this.gridControl1.AlphaBlendSelectionColor; // get the selection color.
}
}


Please refer the following sample which illustrates the above.

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=GC_CCColor1932988202.zip

Regards,
Christopher K.

Loader.
Up arrow icon