I have an ultragrid that is currently styled and I would like to highlight an error row by coloring the text red.
This is easily accomplished by using:
ultragrid.Rows[x].Appearance.ForeColor = Color.Red;
However when ever you select, make active, hot track the item the red text goes to the requisit style. Is it possible to do either of the following:
1) Access the individual state resources for a given row and hand it a resource
or
2) Give a row its own StyleSet?
In regards to #2 I see that there is a spot in ultragrid.Rows[x].Appearance.StyleLibraryName however this does not seem to have any affect.
Any help would be appreciated.
What version are you using? We added a whole bunch of support in the latest (2009.2) version of the grid to make this a lot easier. If you have the latest version, there is an ActiveAppearance and a SelectedApperance on each cell. So you could create an Appearance object and assign the same appearance to the row and also to the ActiveAppearance and SelectedAppearance on each cell within the row.
Using 2009.2, so we are getting really close here, I am doing everything with row selects so hadn't thought to look at the cell level.
So I can do the following:
ultragrid.Rows[x].Cells[y].ActiveAppearance = MyResource;
and that works great. Perfect actually.
However, I can not do the following:
ultragrid.Rows[x].Cells[y].Appearance = MyOtherResource;
I get the following compile error:
Error 1 Cannot implicitly convert type 'Infragistics.Win.AppearanceBase' to 'Infragistics.Win.Appearance'. An explicit conversion exists (are you missing a cast?)
I am sure there is a way to hand a cell a Resource, what am I missing?
Thanks!
Hi,
Well, you didn't post the declaration of MyOtherResource, but the error message seems to indicate pretty clearly that it's the wrong type: it's an AppearanceBase instead of an Appearance.
Thanks Mike.
I just assumed that ultragrid.row.cell.ActiveAppearance and ultragrid.row.cell.Appearance would have been of the same type. We now have a little AppearanceBase to Appearance converter routine and things are working as expected now.
Thanks for your help.
akeroo said:I just assumed that ultragrid.row.cell.ActiveAppearance and ultragrid.row.cell.Appearance would have been of the same type.
Hm... that seems like a pretty fair assumption. Actually, this looks like a mistake, although, I don't think it's something we can change, now.
ApperanceBase is generally for use when the control needs to serialize an appearance at design-time or if you need to be able to point to the name of an appearance rather than an appearance objects itself. So the appearances on a cell should really all be Appearance and not AppearanceBase.
Sorry for the confusion. :)