hi,
i am applying conditional formatting on multiple columns using the following code:
if (cond.P_Condition == CONDITIONAL_FORMATTING.Between && cond.P_Value2 == null)
return;
if (cond.P_Value1 == null)
ConditionalFormattingRuleBase cfrb = RuleFactory(cond);
foreach (Column col in XamMainGrid.SelectionSettings.SelectedColumns)
col.ConditionalFormatCollection.Add(cfrb);
the problem is that the formatting is applied only on the last selected column.
ok thanks
i don't think my rulefactory is too heavy, it's a matter of setting properties based on a switch case.
thanks
Depending on the rules you can Clone the rule object or make a DeepCopy, but this might be an overkill.
If your factory method is not too heavy (from performance point of view) creating multiple rules using the factory is the best option.
if your factory requires a lot of computations, you can create another factory method that just creates a new instance of a rule based on the conditions and values of a pre-computed rule.
Hope this helps
thanks for the quick reply
is there a way i can copy or duplicate the rule instead of going to the ruleFactory method multiple times?
Hi,
A single rule can be applied on only one column. You have only one instance of the rule and it's associated with the last column.
You can move the code creating the rule inside the loop, to create separate rule for each column.
Regards