I have been doing some research on how to display an image in an UltraGrid cell. In my scenario I have a bound column of Type int that represents an index into an image list.
Based on this I decided to show the image by setting the cell's background image. I didn't want to edit the underlying data value or worry about creating a separate unbound column. The first thing I do is set the style of my column to "Image." This hides the cell text, which is what I want... Image only. Then I set the cell.Appearance.ImageBackground and cell.SelectedAppearance.ImageBackground to the image. At this point I have two problems that I have not been able to figure out:
1. The active row/cell ends up hiding the background image. I can't seem to find a "cell.ActiveAppearance" object or something similar to set the image on. How can I prevent the image from being hidden on the active row?
2. A selected row ends up putting blue highlighting in the image cell. I can't figure out how to get rid of the highlighting. I want the image cell to look like all of the others.
Below is a document with a screen shot of the two issues. Row #9 is unselected and not active. It looks ok. Row #10 is selected and you can see the blue highlighting. Row#11 is active and you can see that the image is hidden.
Thanks!
Steve
Hi Steve,
sw06226 said:1. The active row/cell ends up hiding the background image. I can't seem to find a "cell.ActiveAppearance" object or something similar to set the image on. How can I prevent the image from being hidden on the active row?
I can't see any reason why that would happen. There's an ActiveCellAppearance on the Override, but it should not affect the background image in a cell - unless you are setting a different background image on that appearance.
sw06226 said:2. A selected row ends up putting blue highlighting in the image cell. I can't figure out how to get rid of the highlighting. I want the image cell to look like all of the others.
What you should probably do to get around both of these issues is set the ActiveAppearance and the SelectedAppearance on the cell to the Appearance of the cell. That way the cell will look the same in all 3 states (normal, active, and selected). You will probably need to specify a BackColor, in addition to the image on the Appearance.
As always thanks for the reply Mike! I looked at all of the appearances as you suggested and tried many different things. The UltraGridCell object does not have an ActiveAppearance so I was unable to set anything there.
Anyway, all of this got me thinking about the AppSylist. When I change the grid to not use app styling it works just fine and I can see the background image in all cases. It turns out that the default in the AppStylist actually sets a backgroundImage for an active row and a selected row. That is where my trouble is. This image is overriding my cell's background image. So, all I had to do is get rid of the row image for the selected and active row appearance and just put some coloring in instead.
Thanks,