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.

Need Your Help

Python Object awareness of being in an array?

python arrays oop object

Is there a way in Python for an object to 'know' what its array element id is? I.e 6 in an array, and the object itself prints out its own array element number, so '0,1,2,3,4,5'

Resetting a field lazy-loaded with the double-check idiom

java thread-safety locking double-checked-locking

Consider the "double-check idiom for lazy initialization of instance fields":

Is it possible to bind an array to DataGridView control?

c# winforms binding

I have an array, arrStudents, that contains my students' age, GPA, and name like so:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.