If I have certain rows that I want to change the font color, while the whole UltraGrid is using a style library, how do I do that? I tried to set the CellAppearance.ForeColor to that row, but it didn't change. How do I overwrite Stylelibrary settings for a specific row?
Thanks.
Richard Zhu
That was it!!! Thanks a lot Mike. This thing's been bugging me for several days. I'm so glad we finally found the source of the problem. Now I just need to figure out a decent solution to it.
Thanks again for your help.
Richard
Hi Richard,
rzhu said:Is there a way programatically to determine the final resulted ForeColor of a cell, after the overlapping of all layers that sets the property?
No.
rzhu said:Even further, is there a way to find out which layer the final value comes from?
The good news is now that I know you're using a ValueList, I have a pretty good guess about what's going on. :)
My guess is that your application style library is applying a ForeColor to the ValueListItem UIRole. What happens is that when you have a ValueList in the grid and you select an item from the list, the cell picks up the appearance of that item. This makes sense if your items are all differnent colors or if they have images.
In this case, however, it doesn't make sense to use this UIRole in AppStylist. The style library is probably using this role to provide an appearance for every ValueListItem. But this is not a good way to do it, since this will affect the grid cells, as well. So the thing to do is to open up your style library and take a look at the ValueListItem UIRole. It's a direct descendant of the Base role and it's the last one on the list, so it's easy to find. Reset this role and see if that fixes the issue. If it does, and you still have to color the ValueListItems, you can apply the same settings to the ValueList role, instead, and it will affect the ValueListItems, but not the grid cell.
OK, I found the place that the column is set to display text. Turned out that we have our own set of base controls, one of which is the wrapper around an UltraGrid. The wrapper looks for boolean columns and set its ValueList to a 2-valued list. That solves that mystory, but I still don't know who sets my Appearance.ForeColor. Is there a way programatically to determine the final resulted ForeColor of a cell, after the overlapping of all layers that sets the property? Even further, is there a way to find out which layer the final value comes from?
The DataType of the column should not make any difference.
How are you getting the boolean columns to display text? Are you setting the Style? Are you using an editor? Perhaps your style library is applying an appearance to a particular editor type (a SharedObject in AppStylist) and this is somehow overriding the settings in the cells.
Hi, Mike
I just figured out some more detail. I was using exactly the same code as you used in the example, setting CellAppearance.ForeColor of selected row. However, some fields in the row are not displayed in red. Turned out, the 3 columns that does not take the Red color all have their DataType set to typeof(bool), even though on display the values are either "Yes" or "No". Now my question is this: How is the ForeColor configured for a Boolean column? How do I change it. I found that if I specifically set the Cell.Appearance.ForeColor to red, these 3 columns will display red. But since I've already set CellAppearance for the row, I'd like to have a more general solution.
Thanks in advance.