Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
120
Adding EqualToConditional to UnboundColumn to change the background
posted

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);