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
Hello,
Could you please clarify what you mean by dynamically controlling it? You could describe it with an example.
Useful code that, I was looking for a way to dynamically control conditional formating.
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