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?

Answers


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

Responsive CSS /java script DIV - show on click only on mobile query

javascript jquery css menu navigation

I have looked all over online trying to solve this problem. I am in the process of making a desktop website responsive for mobile and have run into issues with the Navigation menu. I have set it to

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.