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
1675
Switch dataset by recycling the cells
posted

Hi,

I have two data sets that i want to quickly switch back and forth on the grid. Both the datasets are type observablecollection and the column order, style are the same, so i want to recycle the cells, at present when i switch between the two ItemSources I see that all the cells are re-created and this takes up a few seconds. As the user of my app would do this multiple times in a day the slight pause looks very annoying to them.

Is there a way or a property that I can use so the grid could recycle the cells instead of creating all cells from scratch when the underlying source is switched?

Thanks,

Rohit

Parents
  • 6759
    Verified Answer
    Offline posted

    Hi Rohit,

    I think I have a workaround for you - assuming that the items in the different data sets are of the same type.

    You need to create a wrapper class implementing IEnumerable<T>INotifyCollectionChanged which will wrap your data sets and will make the switch between different data sources to look like a CollectionChanged(Reset) to the xamGrid.

    You could check out the attached sample for the actual implementation. I've verified that no new CellControls are created during the switch of the data sets.

    Hope this helps.

    ItemsSourceSwitch.zip
Reply Children
No Data