This project has moved and is read-only. For the latest updates, please go here.

Benefit of IoC container in MVVM

Apr 16, 2014 at 2:39 PM
Edited Apr 16, 2014 at 2:40 PM
What is the benefit of IoC container in MVVM Light? What is the benefit of the ViewModelLocator? Why not instantiating the view-models directly in the XAML file like below:

    <!-- Other user control elements here -->

May 11, 2014 at 5:29 PM
There are multiple reasons and I encourage you to read this:

Mainly, the way you use up there gives you zero control on the lifetime of the ViewModel, and also forces you to use parameter-less constructors, which is limiting.

Jun 5, 2014 at 11:25 AM

First, I'd like to say "Bravo !" for this MVVM Light Toolkit. Real a splendid work.

I'm starting to learn it (discovering MVVM at the same time) and it is very helpful to get samples... :-)
Especially on this IoC topic for which I've not fully understood all the intrincacies.

However, in the above referred article (MSDN) it appears that the sample is no longer available (Archive Gallery has been retired). Would you mind to tell where I can get this Code Sample?

Jun 5, 2014 at 2:31 PM
Hi and thanks for the kind words. I need to talk to the editor of MSDN magazine to see what's up with that.