I have succesfully used ValueBasedAppearance to conditionally change the colors in cells. The problem is that when the row where this cell lives is activated, the Appearance takes over and I lose the formatting. This goes back to normal as soon as another row is selected but my users are requesting that at least the ForeColor of those cells stays the same.
Does anybody know how to achieve this? I am using 2007.1
Thanks!
Sebastian
Sorry, I was incorrect. It seems that the CellContextProvider class for this is internal. You should be able to pass in null for that parameter anyway, though if you need to solve formulas you could probably implement the IConditionContextProvider interface yourself and return the cell of the column as the Context. As for the value, you should be using the cell's value if you aren't doing anything to modify what's shown to the user (i.e. DataFilter, ValueList, etc).
-Matt
Nope, It can't cast a column to an IConditionContextProvider. What would be the"data value" anyway, the cell's content?
The context is generally only used in a FormulaCondition, so if you have that you could pass in the instance of the column as the IConditionContextProvider, I believe.
Mike,
I'm almost there. The problem is that the KB code I got overrides with the cell appearance, but that appearance doesn't take into account the ValueBasedAppearance applied. I tried to use "Resolve Appearance" to get to the actual ForeColor being used but there are two properties
(ByVal dataValue As Object, _ ByVal context As IConditionContextProvider)
that I don't know how to fill. I looked in the forms and in the help but can't find anything useful.
Any help is greatyl appreciated.
Thanks Mike, I'll take a look and get back here if there are more issues.