Search code examples
wpfdependency-injectionprismmef

Preloading WPF listview with many items


I am using Prism and MEF to create a WPF GUI. I am curious to know if there is a way to pre-populate WPF controls before a user views it.

Specifically, I have a UserControl that uses a ListView to present a list of about 8000 items retrieved via network call over WCF.

I have determined that it is not the network call that is the bottleneck, but rather the creation of the ListView itself. The WPF ShellViewModel currently does a network prefetch so that all required data is present on the client side, but since I am using dependency injection with Prism/MEF, the view does not get created until the user clicks on the Tab containing this ListView and subsequently "freezes" while the ListView is created (populated with the 8K items). I suspect that LazyLoading of view dependencies has a part in this as well.

Is there a way to move this ListView creation to the bootstrapping phase of the application? I would like the have this view loaded/populated before the user clicks on it so that there is no "lag".

Reducing the number of items to be viewed is not an option.

Thanks.


Solution

  • Try Virtualization, sounds like this is exactly what you need.