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
175
Performance hit when setting cell.ValueList in InitializeRow (or how to suspend repainting?)
posted

I have a bound grid with several columns. One column is a custom drop-down list. Items of list depend on row data (varies from row to row). 

Setup of such column is performed in InitializeRow event by creating ValueList, adding required items (with correct one which corresponds to bound data), and setting this ValueList to required column's cell with cell.ValueList = list. 

When grid is shown for the first time and data (around 1200 rows) is bound, SetDataBinding executes in no time (<0,1s) (it is possible that data is bound while grid is not visible yet).

But, if other data of the same amount is bound to the same grid, SetDataBinding blocks for about 20s.

I've analyzed execution with performance profiler and found that while setting value list to cell - cell.ValueList = list - redraw/invalidation of the grid is invoked which slows down performance:

Infragistics.Win.ControlUIElementBase.VerifyIfElementsChanged(Boolean, Boolean), 
Infragistics.Win.UIElement.VerifyChildElements(Boolean)
Infragistics.Win.UltraWinGrid.UltraGridUIElement.VerifyChildElements(ControlUIElementBase, Boolean)
... etc

If I comment out  cell.ValueList = list; line, grid is bound in milliseconds every time.

Code of setting cell.ValueList is executed in BeginUpdate/EndUpdate of grid.
I've tried several other options (SuspendRowSynchronization, BeginInit, even grid.Visible = false) but with no luck.

I suspect that after data is bound to a grid for the first time or grid is drawn for the first time, any subsequent bindings/redraws are not suspended in the same way? 

Is there any way to suspend all grid repainting/invalidating and invoke them after all cell.ValueList's are set? Or somehow suspend cell.ValueList invalidations?

Parents Reply Children