开发者

How to work with ViewModelLocator in Mvvm Light

开发者 https://www.devze.com 2023-01-05 10:04 出处:网络
I have just started to use and learn mvvm pattern with the help of MVVM L开发者_运维百科ight toolkit. I want to use MVVM Light in my project but I dont know how to use ViewModelLocator. I am not getti

I have just started to use and learn mvvm pattern with the help of MVVM L开发者_运维百科ight 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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消