Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
210
Alternate highlight for a specific column
posted

 

Hi

I am trying to set alternate row coloring for a wingrid.

I use the

Grid.DisplayLayout.Override.RowAlternateAppearance.BackColor and

Grid.DisplayLayout.Override.RowAppearance.BackColor and it works fine.

Now I want just one column to have a different set of alternate coloring. I use the row init event to set the appropriate backcolors to the rows and it all works fine.

But when i sort on any column, the alternate row coloring goes awry for that specific customised column.

Thats because the coloring still sticks with the cell and is not reapplied according to the new sorted order of alternate rows.

Is there any direct property that will allow me to set different set of colors for a specific column?

 

 

  • 469350
    Verified Answer
    Offline posted

    If you are coloring the rows in the InitializeRow event, then the rows should be re-colored when you sort them. If that's not happening, then I guess InitializeRow doesn't fire when you sort. But this is easily handled. All you have to do is trap the AfterSortChanged event and call grid.Rows.Refresh(FireInitializeRow).