Hi,
I have a 3-tier application (WCF, WPF, Prism, Unity and MVVM), I receive 1M models (for example Person) from the server which need to be shown in the XamDataGrid. My ViewModel exposes an ObservableCollection<PersonViewModel>, where PersonViewModel are simply wrapper around the model Person. Those wrapper are kind of big, and long to construct since the constructor parameters are mapped dynamically by unity framework. Would it be possible to lazy build those wrappers and ideally recycle them (basically virtualize them), so that only the shown records have a wrapper instance? It's require that the solution work with filtering, sorting and grouping!
Thanks,Dominik
Hello Dominik,
The XamDataGrid requires all of the records to be loaded to provide filtering, sorting and grouping.
If you have further questions, please let me know.
Thanks,
Hi Francis,
Thanks for your answer.
Still, do you have any suggestion to handle that kind of problem.
Regards,
Dominik
Hi Dominik,
I'm checking into this and will post here what I find out.
I received information from our WPF Engineering team; apparently, there is a considerable amount of work to do to accomplish this. Hopefully, this explanation helps:
In the case without sorting or grouping, the control only asks for the data as the data is brought into view. So the PersonViewModel wrappers would effectively be created lazily.
However, once a record is brought into view, and we ask the data source for the corresponding dataitem (which in this case is the PersonViewModel wrapper), we don’t ‘discard’ the dataitem when the record goes out of view. So, there is no way to recycle the wrappers. Plus, if [you] are using sorting and filtering then the ‘lazy load’ won’t even happen, because we ask for all the records up front.
There are no XamDataGrid options to achieve this requirement. [You] would have to implement a virtualizing datasource that supports recycling. That’s not a trivial task.
Dominik,
Do you have any questions in light of the reply from Engineering above?