Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I have been using the MVVM light toolkit in my WPF applications for some time now and I often encounter a similar problem when designing the ViewModelLocator. I am never sure which view-models should be exposed through the locator. Let me explain my question with an example.

I have an application which has only one window. The window always shows exactly one page(Page is a user control). The window contains only the selected page and nothing else. There are three pages defined in the application. The StartPage, MainPage and the FinishPage. The content of the start and finish pages is mostly static. The MainPage contains one or more subpages(which subpages are contained within the MainPage is specified in an external XML file), but at any given time at most one subpage is visible. Each page and each subpage has it's own view-model. So which view-models should be accessible through the locator? Should the locator contain only the property for the MainViewModel(view-model for the window) or also the page view-models or maybe even view-models for the subpages?

I hope my question is understandable. If I failed to explain my question please let me know so I can provide additional information. Any thoughts on the subject will be appreciated

Uros
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900