We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Selection style

Thread ID:





63037 Jun 27,2007 11:25 AM UTC Jun 27,2007 08:02 PM UTC WinForms 1
Tags: GridControl
Richard Mitchell
Asked On June 27, 2007 11:25 AM UTC

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?

haneefm [Syncfusion]
Replied On 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,


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon