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. Image for the cookie policy date

Selected cell back color, how to make it look like the selected row?

I have a GridDataBoundGrid.

Listbox Selection Mode is set to "One".

I want the selected row to have a border, like it has now, but I also want it to have the same color as the selected row. In the screenshot attached, the selected row is BLUE, but the current cell is WHITE.

How can I make the current cell blue, like the rest of the line?


Thanks!



picklist_5f0520c1.zip

5 Replies

SR SubhaSheela R Syncfusion Team August 28, 2008 05:17 AM UTC

Hi Philippe,

Thanks for your interest in Syncfusion products.

You can change the back and text of the selected row by handling PrepareViewStyleInfo event of the GridDataBoundGrid Control.

Below is the code snippet:


private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs e)
{

if (this.gridDataBoundGrid1.Selections.Ranges.AnyRangeContains(GridRangeInfo.Cell(e.RowIndex, e.ColIndex)))
{
if (e.RowIndex != 0 && e.ColIndex != 0)
{
e.Style.BackColor = Color.Blue;
e.Style.TextColor = Color.Cyan;
}
}
}


Please let me know if it helps.

Regards,
Subhasheela R




PM Philippe Marseille September 2, 2008 01:04 PM UTC

Alright, that worked to change the color of the selected row. What I want is to have the selected CELL not to be white.

I'm using "listviewselectmode = One". The grid puts an alpha blending on the selected row, but not on the selected cell. It stays white.

How can I do that? (have the AlphaBlending on the selected cell?)



SR SubhaSheela R Syncfusion Team September 5, 2008 04:34 AM UTC


Hi Philippe,

Thanks for your update.

You can select the entire row in same color wherever you click by setting the code snippet that I have sent previously.

Here is the sample that illustrates the same:

GDBGSelectedRowBackColor.zip

You can also refer the browser sample available in below path that discusses the same:

\\MyDocuments\Syncfusion\EssentialStudio\6.3.0.25\Windows\Grid.Windows\Samples\2.0\DynamicFormatting\HighlightCurrentRow\cs

Please let me know with more details if this does not serve your need.

Regards,
Subhasheela R



PM Philippe Marseille September 5, 2008 04:31 PM UTC

Yes, that was exactly what I was looking for.

Thank you ;)



SR SubhaSheela R Syncfusion Team September 9, 2008 05:20 AM UTC


Hi Philippe,

Thanks for your update.

Please feel free to open a new one if you need any other technical concern.

Regards,
Subhasheela R


Loader.
Live Chat Icon For mobile
Up arrow icon