Click here to Skip to main content
12,302,307 members (24,446 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# WPF C#4.0 MVVM
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 1-Jan-13 10:13am
koleraba1.2K

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160530.1 | Last Updated 1 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100