Selection style

I would like to be able to have complete control over how a cell is rendered when it is selected ( or normally when the row is selected ).

Is there anyway I can find out if the cell should be rendered in a selected way from inside the Draw of a custom GridStaticCellRenderer or the associated GridStaticCellModel.

What I'm trying to do is have selected rows be solid yellow background but some columns need to have an orange background. I've tried this with the alpha blending but I can't get the solid colours I need.

Already in my grid some rows are blue others white but if they are blue or white I still want them to be yellow/orange when selected.

Any way I can do this?

1 Reply

HA haneefm Syncfusion Team June 27, 2007 08:02 PM UTC

Hi Richard,

You can hanlde the PrepareViewStyleInfo event of the grid and change the color of the selected using the e.Style.BackColor property from the GridPrepareViewStyleInfoEventArgs. Belwo are the code snippet to show this.

void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
GridDataBoundGrid _grid = sender as GridDataBoundGrid;
if( _grid.Model.SelectedRanges.AnyRangeIntersects(GridRangeInfo.Cell(e.RowIndex,e.ColIndex)) )
e.Style.BackColor = Color.Yellow;
}

Best regards,
Haneef

Loader.
Up arrow icon