Hi,
Within a WinForms UlraGrid, I am looking for a means (via code) to alter the appearance of an entire row, whenever a targeted column value meets a certain condition. For example, I already know that I can target the respect cell via the ConditionValueAppearance. The closest I could find to what might work is the ConditionAppearanceRow Class. Unfortunately you don't provide any code snippets to demonstrate how this class is hooked up with a given DisplayLayout Band.
In any case, I need this capability through code, so I can set the row appearance on the fly. If there is another way to do this, I am all ears.
Thanks,
Lacy
What does the code in your InitializeRow look like?
Hi Mike,
I implemented a conditional appearance in my initialize row event (changes backcolor based on value), but now I am seeing a slower response time when I change the rowfilter on the dataview the ultragrid is bound to. Do you have any performance tips?
Thanks,Kelly
Thanks Mike. I figured out that my problem was that when raising the PropertyChanged event of the object in the BindingList, I didn't supply a property name (because multiple properties changed at the same time). I changed my code to supply an arbitrary property name and the InitializeRow event started to fire on updates. Don't know if this is a UltraGrid or a BindingList requirement, but it works now.
Hi Max,
Assuming that your data source is an IBindingList and notifies the grid that the field value has change, then the grid will update the display of the row automatically and fire InitializeRow. So you would do this the same way.
If your data source is an IList, then the grid will not be notified. So you can manually trigger the InitializeRow using the grid.Rows.Refresh method - just be sure to pass in FireInitializeRow.
I have a follow-up question. The InitializeRow event fires when a row is first added, or when the data for the row is refreshed explicity. In my case, I need to set the appearance of the whole row when the data is updated as a result of the values in underlying BindingList changing (these values change as a result of events external to the UI - so I cannot capture any user data entry events).
E.g., if the 'status' field of an object in the BindingList changes from 'OK' to 'Warning' then the entire row should be displayed in red.
What is the recommended way to address this scenario using the UltraGrid?
- Max