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
390
ValueBasedAppearance / Conditional Formatting
posted

Does the ValueBasedAppearance (Conditional Formatting) not work in a ComboBox?  I spent the better part of a day trying to figure out why a column on a ComboBox did not reflect the Conditional Formatting I was using on a single column of the ComboBox.  So... in an attempt to clarify, I created a form that had a ComboBox and and Ultragrid bound to the same data source and using the same columns.  In both combo and grid I used the ValueBasedAppearance to set the same conditional formattting for the same column.  The grid functions as expected, but the combo does not show any formating of the column to which the conditional formatting should have been applied.

I am using  NetAdvantage 2008 V2 for CLR2

Thank you

Parents
  • 37774
    posted

    The ValueBasedAppearance should definitely be reflected in an UltraCombo.  In a quick sample, I was able to get this working:

     public Form1()
    {
        InitializeComponent();

        this.ultraCombo1.DataSource = GetTable();
    }

    private void ultraCombo1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
    {
        ConditionValueAppearance app = new ConditionValueAppearance();
        Infragistics.Win.Appearance appearance = new Infragistics.Win.Appearance();
        appearance.BackColor = Color.Red;
        app.Add(new OperatorCondition(ConditionOperator.LessThan, 3), appearance);

        e.Layout.Bands[0].Columns["Col 2"].ValueBasedAppearance = app;
    }

    private static DataTable GetTable()
    {
        DataTable dt = new DataTable();
        dt.Columns.Add("Col 1");
        dt.Columns.Add("Col 2", typeof(int));
        dt.Columns.Add("Col 3", typeof(bool));
        dt.Columns.Add("Col 4", typeof(decimal));
        dt.Columns.Add("Col 5", typeof(DateTime));

        for (int i = 0; i < 5; i++)
        {
            DataRow row = dt.NewRow();
            row["Col 1"] = "Row " + i.ToString();
            row["Col 2"] = i;
            row["Col 3"] = i % 2 == 0;
            row["Col 4"] = i * 1.234m;
            row["Col 5"] = DateTime.Today.AddMonths(-i);

            dt.Rows.Add(row);
        }

        return dt;
    }

    I would recommend that you submit a small sample to Developer Support so that they can take a look at it.

    -Matt

Reply Children
No Data