Views and viewmodels grouped in subfolders

Jun 12, 2013 at 6:39 AM
Edited Jun 12, 2013 at 6:39 AM

typically a business application has several views and viewmodels and I would like to group them in subfolders, for example:


If I put views in different subfolders it seems they are not registered in the container.

For the viewmodels the only way I found is to put viewmodels in different sufolders but with the same namespace; in this way I can define an easy rule to resolve viewmodels.
Maybe I can use a different rule to resolve viewmodels, for example replacing Views with ViewModels in the full type name. Could it work?
Jun 12, 2013 at 5:59 PM
The default looks for the views in the Views folder and view models in the ViewModels folder. If you want your own scheme, you need to add some additional code and store them where you wish. I use the default, but try looking for GetPageNameToTypeResolver Method or the AdventureWorks app as a demo.
Jun 13, 2013 at 6:36 AM
There is also documentation that describes how to change the conventions for where views and view models are located. You can find it Using Prism for the Windows Runtime.
Jun 13, 2013 at 6:52 AM

I'll try overriding GetPageType.
Thank you very much.
Jun 27, 2013 at 1:46 AM
What I do is I moved them into different folder but i keep the namespace to Views

For example the view LoginView is in the folder appName\Views\Login
but the namespace is still appName.Views

it works like a charm :-D
Jun 27, 2013 at 4:39 PM
@Halloween, that is a really good idea. I never thought of that, but believe it will help in managing views as my app grows over time. Thanks!