I have a UltraWinGrid and one column has a ValueBasedAppearance which changes the ForeColor of the cell based on the value. This works great. The problem occurs when the row is selected, and then the ForeColor of that column is being changed. Is there a way for the cell to keep it's ValueBasedAppearance even when it's selected?
Or - is there a way I can get the ValueBasedAppearance from within my DrawFilter... so I can override the SelectedAppearance? (For example, if a cell has an appearance with a ForeColor, my custom DrawFilter does not change the color when the row is Selected).
This isn't urgent as I could just add this cell drawing to my custom DrawFilter, and determine the ForeColor correctly there. I'm just wondering if there was an easier way. Thank you.
Hi Steve,
Since we added an ActiveAppearance and a SelectedAppearance to Cell you can just set all three to the same Appearance object inside the InitializeRow event and forego the DrawFilter.
Of course, if you are already using the DrawFilter and it works, there's no reason to change it. :)
Hi Mike,
Thanks for the reply. That's exactly what I've done. I use InitializeRow to do my coloring, and then the DrawFilter (from http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=3197 - HOWTO:How can I have Selected cells in a grid maintain their forecolor? ) keeps the same cell appearance for selected rows/cells. It works fine, but I was just curious if I was missing anything with trying to use the ValueBasedAppearance (which got me 90% of the way there without writing a line of code).
Thanks, Steve
Hi,
I recommend using the IniitalizeRow event to set the Appearance on the cell, instead of using the ValueBasedAppearance. What you can do is set both the Appearance and the SelectedAppearance on the cell, so that way the ForeColor is the same in both states. You may want to set the ActiveAppearance on the cell, as well, if you are using an ActiveRowAppearance in your grid.