I have data in a winGrid in which the text in certain cells displays in a specific color. I set the color in the initializeRow event of the grid. When the row is not selected, I get the correct colors. However, when the row is selected, it displays in the standard colors. I have tried setting the SelectedAppearance property of the cell in the Initialize Row event but it has no effect.
I've tried several approaches
e.Row.Cells("TaskAction").SelectedAppearahce.ForeColor = Color.red
e.Row.Cells("TaskAction").SelectedAppearance = e.Row.Cells("TaskAction").Appearance
I still get the standard black on blue appearance when selected. What am I doing wrong?
Thank you Mike, Setting the ActiveAppearance as well as the SelectedAppearance did the trick.
Setting the SelectedAppearance should work. My guess is that the row is not selected (or not ONLY selected), but it also active. So you might try setting the ActiveAppearance on the cell, too.
Or you could turn off the ActiveRowAppearances that are applied to the grid by default.
FAQ:How do I turn off the ActiveRowAppearance so that the active row in the grid does not appear selected.
Hi,
try this sample.
i got it from one of the posts long time ago but i couldn't find the link so i will post it as i got it.