Is there an example available on how to set the back color of a cell from a draw filter. The backcolor of each cell will depend on the data in the cell, whether or not the row is selected (I'd like to override the selected colors), and user preferences stored in other variables. I've successfully implemented the sample code that maintains the forecolor of the text in the cell, but I've been unable to generalize that into working for the backcolor as well.
I don't think there's a KB article specifically for this. There's one for ForeColor, I know. They are very similar, but the BackColor of the cell is drawn by a different element than the ForeColor. So I think you need to check for the CellUIElement.
I tried the CellUIElement as well as the TextUIElement.
Maybe I'm looking for the wrong drawphase?
I've tried BeforeDrawElement and DrawPhase.BeforeDrawForeground. In both cases, I get to the code that sets the appearancedata.backcolor appropriately, but there must be something subsequently that resets it, because it always shows a white background when selected (instead of red which is the cell's appearance.backcolor and what I'm setting it to in the drawfilter. The forecolor on the textuielement works fine and keeps the color that I set in the drawfilter when selected (as in the Forecolor KB Article and sample code provided.)
Okay, it looks like it's the embeddable element (the editor) that handles drawing the BackColor. So the element you need to look for is EmbeddableUIElementBase.
I've updated the sample from the KB article to work with both ForeColor and BackColor and I am attaching it here.
Thanks Mike. That did it. I appreciate your help.
Which KB article discusses changing the cells ForeColor? I found the one regarding the cells border color but not the one for the text. Thanks.