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
2005
How to avoid recreation of grid related objects
posted

Hello,

I am using an UltraGrid with virtual mode; the CellDataRequested event handler provides cell data from a data collection. The data in the collection are updated by a background thread. When the grid needs to refresh the follow statements are used:

_ultraDataSource.Rows.SetCount(_displayedViewRecords.Count);
_ultraDataSource.ResetCachedValues();
_ultraGrid.Rows.Refresh(RefreshRow.FireInitializeRow, true);

I noticed that most objects used within the grid are recreated:
One instance of each following class is created for grid:

Infragistics.Win.UltraWinGrid.DataAreaUIElement
Infragistics.Win.UltraWinGrid.UltraGridUIElement
Infragistics.Win.UltraWinGrid.RowColRegionIntersectionUIElement
Infragistics.Win.UltraWinGrid.RowSelectorHeaderUIElement

One instance of each following class is created for each row:

Infragistics.Win.UltraWinGrid.RowUIElement
Infragistics.Win.UltraWinGrid.RowSelectorUIElement
Infragistics.Win.UltraWinGrid.RowCellAreaUIElement

One instance of each following class is created for each column:

Infragistics.Win.UltraWinGrid.BandHeadersUIElement
Infragistics.Win.UltraWinGrid.HeaderUIElement
Infragistics.Win.TextUIElement

One instance of three or more classes is created for each cell.

I thought all the objects within the grid would be reused as much as possible. The data in my data collection are constantly updated and the grid performance is affected by the recreation of these objects within the grid. I am not sure if I have done something wrong.
Could someone point me in the right direction please?

Thanks,
Shaolin

Parents
No Data
Reply
  • 21795
    Offline posted

    Hello Shaolin,

    This is expected behavior. Each time a cell value changes the related CellUIElement invalidates and repaints. Actually everything you see on the screen is drawn via hierarchical structure of UIElements. This is a core concept in most of Infragistics Controls for Windows Form. You may follow the next link to our online documentation to find more information about our Presentation Layer Framework http://help.infragistics.com/Doc/WinForms/current/CLR4.0/?page=Win_Presentation_Layer_Framework_PLF.html.

    One thing you may change in your code is to call Refresh of the grid rows with RefreshRow parameter set to ReloadData like this:

    this.ultraGrid1.Rows.Refresh(RefreshRow.ReloadData, true);

    This way you will not force the grid to reinitialize all its rows again.

    Please tell me exactly what your issue is? Do you face some bad performance? How big your data is? How much rows and columns your grid consist of? Can you send me a sample reproducing this behavior?

    Looking forward to your reply.

Children