Lazy loading large data sets in wpf tabs using MVVM
I should start by saying I'm relatively new to the MVVM pattern. Having said that, I've got two tabs I'm trying to load with large data sets. I would like for the first tab to load when the page is loaded, but when you click the other tab for the first to be unloaded and the second to be loaded (aka Lazy Loaded). Any ideas as to how to do that?
It's important to keep the UI responsive to the user and loading large amounts of data can have a negative effect on that experience. That's why in situations like yours I have the view-model call a method that uses a BackgroundWorker(s) to load the data. The earlier you do this in the app's lifecycle, the better your user's experience.
So, like mathieu suggested, bind the control's property to your view-model and have your view-model load the data in a non-blocking fashion.