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
550
EqualToConditionalFormatRule applied to ConditionalFormattingCellControl.ContentProperty
posted

Hi,

 I have a requirement where if the cell content is "Y" i should display "Yes" and if it is "N" it should display "No". for this i am using. For this i am writing a EqualToConditionalFormatRule. my code is as follows

 

EqualToConditionalFormatRule MyRule = new EqualToConditionalFormatRule();

MyRule.Value = strColVal; //this is "Y"

MyRule.StyleScope = StyleScope.Cell;

Style style = new Style();

style.TargetType = typeof(ConditionalFormattingCellControl);

Setter setter = new Setter();

setter.Property = ConditionalFormattingCellControl.ContentProperty;

setter.Value = item.Value.RuleReplacementString;// this is "Yes"

style.Setters.Add(setter);

MyRule.StyleToApply = style;

dataGrid.Columns.DataColumns[item.Value.ColumnName].ConditionalFormatCollection.Add(MyRule);

 

But nothing happens.My cell values "Y" is not replaced with "Yes".

I need to do this in code behind since my rules are loaded dynamically.

Can you tell me where i am going wrong.