ConditionGroup conditionGroup = new ConditionGroup(); OperatorCondition operatorConditionA; OperatorCondition operatorConditionB; ConditionValueAppearance CondValue = new ConditionValueAppearance(); Appearance condAppearance; object objValue1 = 10.1, objValue2 = 19.7; //Customize appearance condAppearance = new Infragistics.Win.Appearance(); condAppearance.BackColor = Color.White; condAppearance.ForeColor = Color.Blue; operatorConditionA = new OperatorCondition(ConditionOperator.GreaterThan, objValue1); operatorConditionB = new OperatorCondition(ConditionOperator.LessThan, objValue2); conditionGroup.Add(operatorConditionA); conditionGroup.Add(operatorConditionB); conditionGroup.CombineOperator = LogicalOperator.And; CondValue.Add(conditionGroup, condAppearance); UltraGrid1.DisplayLayout.Bands[0].Columns["Grade"].ValueBasedAppearance = CondValue; Assume I have the following values in column "Grade": { 7, 8, 10, 10.1, 10.2, 10.3, 15, 18, 19.6, 19.7, 19.9 } I set column decimal format to 0, so visible values become: { 7, 8, 10, 10, 10, 15, 18, 19, 19, 19 } I do the following conditional formatting and I obtain the following values affected: { 15, 18 } What I want is compeltely different, I want the conditional formatting to work on cell original value { 10.2, 10.3, 15, 18, 19.6 } and show me the following cells affected: { 10, 10, 15, 18, 19 }
I just tried this out and it worked correctly for me, in that I had {10, 10, 15, 18, 20 } all with a ForeColor of Blue (the last value was 20 since 19.6 was rounded up by the Format). What version of the controls are you using? It's possible that an issue was addressed in the latest service release for your version. For what it's worth, I added all that code in the InitializeLayout event, but I didn't actually change anything.
-Matt
Hi Matt,
I am using the version 9.1.20091.1000.
it's not working with me.
the case is when i have 10.9 which will be displayed as 11 (if I press F2 it will show 10.9) i tried to add the conditional formatting to color the values equal to 11, it wasn't colored
Hi Mike,
I guess i wasn't clear in my post.
the condition is lessThan or Equal to 10.1
the fourth cell's value is 10.108. but it's appearing as 10.1 due to the format applied.
so what i am facing is that the fourth cell is not highlighted. i just want to know if there is a way of doing that based on the text of the cell not the Value.
thx
Oh, I see. No, I don't think there is any way to do that with conditional formatting.Except for the obvious way, which would be to change the value of the condition to a higher value. You could change it to 10.15, for example - assuming you know the formatting.
Another option might be to use the InitializeRow event instead of Conditional Formatting. Conditional Formatting is really designed to be used at run-time, anyway. It's actually more code to set it up at design-time than to use InitializeRow. In InitializeRow you could examine the Text property of the cell and use double.Parse to get a value from the text and use that as the basis of your condition instead of the actual cell Value.
Mike Saltzman said:Conditional Formatting is really designed to be used at run-time, anyway.
Oops. I meant to say "Conditional Formatting is really designed to be used at design-time, anyway."
hi Mike,
I want also to save the conditional formatting applied by the user. currently this is done by saving the layout of the grid.
If i use the initialize row, i guess it wont be save when saving the grid's layout.
Ah, okay. Well, that's a reason to use ConditionalFormatting, then. :)