Tarun
Tarun

Reputation: 81

How to work with ViewModelLocator in Mvvm Light

I have just started to use and learn mvvm pattern with the help of MVVM Light toolkit. I want to use MVVM Light in my project but I dont know how to use ViewModelLocator. I am not getting what it is used for. Kindly suggest with samples or examples.

Thanks

Upvotes: 2

Views: 1477

Answers (1)

Chris Koenig
Chris Koenig

Reputation: 2748

The locator is a repository of view models. You use it to get access to the view models in your application. The app.xaml defines a global instance of the locator, and individual views can bind their datacontext to properties of the locator which serve up the individual VMs. Check out my sample app to see how things are wired together.

Upvotes: 1

Related Questions