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
5520
Conditional Formatting
posted

hi

i am using the following code to apply conditional formatting on selected columns.

it's always hiding the values of the cells (that meet the condition) .

i set the r.CellValueVisibility =  System.Windows.Visibility.Visible; but the same problem.

 

ContainingConditionalFormatRule r = new ContainingConditionalFormatRule();

                r.CellValueVisibility =  System.Windows.Visibility.Visible;

                r.StyleScope = StyleScope.Cell;

                r.ShouldRefreshOnDataChange = true;

 

            Style s = new Style(typeof(CellControl));

            FontWeight fw = format.P_IsBold?FontWeights.Bold:FontWeights.Normal;

            FontStyle fs = format.P_IsItalic?FontStyles.Italic:FontStyles.Normal;

            s.Setters.Add(new Setter(FontFamilyProperty,format.P_FontName));

            s.Setters.Add(new Setter(FontSizeProperty,format.P_FontSize));

            s.Setters.Add(new Setter(BackgroundProperty,format.P_BackColor));

            s.Setters.Add(new Setter(ForegroundProperty,format.P_ForeColor));

            s.Setters.Add(new Setter(FontWeightProperty,fw));

            s.Setters.Add(new Setter(FontStyleProperty,fs));

            r.StyleToApply = s;

            r.Value = "Ame";

           foreach (Column col in XamMainGrid.SelectionSettings.SelectedColumns)

           {

               col.ConditionalFormatCollection.Add(r);

           }