Am programmatically adding an unboundColumn, adding a ValueConverter to it and adding a ConditionalFormatCollection by defining EqualToConditional to change the background of the cell depending on the cell value, It doesnt work.
Below is the code
Style s = new Style();s.TargetType = typeof(ConditionalFormattingCellControl);s.Setters.Add(new Setter(ConditionalFormattingCellControl.BackgroundProperty, new SolidColorBrushColors.Green)));
EqualToConditionalFormatRule
equalRule = new EqualToConditionalFormatRule();equalRule.Value = 1; equalRule.StyleToApply = s;equalRule.StyleScope = StyleScope.Cell;
UnboundColumn imgColumn = new UnboundColumn { Key = brkr.BrokerName + "Img" }; imgColumn.ValueConverter = new CommentTypeIconConverterX();imgColumn.ValueConverterParameter = brkr.BrokerName + "Img";imgColumn.HeaderText = " ";imgColumn.ConditionalFormatCollection.Add(equalRule);xamFileDetailsGrid.Columns.Add(imgColumn);
Hi doyouknowme,
Let me know if you have any further questions on this matter.
Conditional formatting rules check the underlying data object so in order to apply one to an UnboundColumn you can create a custom rule and perform logic on your data object that determines what style to apply to the current cell or null for no style. I've attached a sample that demonstrates how you could do this.
Let me know if you have any questions on this.