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

CurrentCell Selected Text Color

I am having trouble setting the color for selected text in the CurrentCell of the GridDataBoundGrid.

I have the foreground color for the CurrentCell set to Color.White and the background color set to Color.DodgerBlue. I also have set the CurrentCell to select all the text when you click it as follows:
grid.ActivateCurrentCellBehavior = GridCellActivateAction.SelectAll;

These settings works but the selected text is highlighted with a blue color that is so similar to Color.DodgerBlue that you can't tell the difference.

I would like to change the selected text color to provide more contrast. Please could you let me know how to do that?

3 Replies

BG Ben Guy November 14, 2013 03:29 PM UTC

As well as setting the background color for text selected in the text box I also need to change the text box cursor style to make it more distinct. At the moment, the cursor position is very hard to see in the field.

Please see attached zip file containing pictures that show the selected text background color and cursor appearance problems.


problems_845e9a26.zip


AS Athiram S Syncfusion Team November 21, 2013 05:41 AM UTC

Hi Ben,

The simplest way is to derive the grid, and override OnSetCursor.

Here is a sample.

http://www.syncfusion.com/support/user/uploads/7343.zip

You can add additional checks to narrow where you set the cursor.

Please let me know if you have any concerns.

Regards,
Athiram S


AS Athiram S Syncfusion Team November 21, 2013 05:51 AM UTC

Hi Ben,

I have here added a technique for changing the selection color.

The SelectionBackColor property in the TableOptions can be used to set or change the back color of a selection in the Grid.

Code:

this.GridGroupingControl1.TableOptions.SelectionBackColor = Color.Pink;

UG Link:

http://www.syncfusion.com/support/kb/547/How%20can%20I%20setchange%20BackColor%20of%20a%20Selection%20in%20GridGroupingControl

Please let me know if you have any concerns.

Regards,
Athiram S


Loader.
Live Chat Icon For mobile
Up arrow icon