Good day.
I have an UltraGrid with some columns and rows, such as:
id, some data, ReadStatus-(boolean value)
1 Peter Adams true
2 John Smith false
I want to display the rows in bold, where the cell value(in ReadStatus) is equal to true, as in the Outlook.
I can get around all the rows in the cycle after filling the dataset and set the style values, but, when I have large amounts of data, the UltraGrid begins to take a long time.
Is there a way to assign style of each row when filling dataset?
P.S. Sorry for my English, its not my native language.
UltraGridColumn supports condition-based appearances, which provide a way to apply visual attributes based on a cell value. In your case you would do something like this:
ConditionValueAppearance cva = new ConditionValueAppearance();
Infragistics.Win.OperatorCondition condition = new OperatorCondition(ConditionOperator.Equals, true);
Infragistics.Win.Appearance appearance = new Infragistics.Win.Appearance();appearance.FontData.Bold = DefaultableBoolean.True;
cva.Add( condition, appearance );
column.ValueBasedAppearance = cva;
If you are setting this up at design-time, then using the ValueBasedAppearance property on the column is an excellent way to do it.
If you are going to write code to do this at run-time, then it's actually a lot easier and a lot less code to use the InitializeRow event. Check out the WinGrid Performance Guide.
The very last section entitled "Re-Use Appearances" explains how to do this in the most efficient way.