All Universal Windows apps following MVVM pattern should have a similar directory structure. The following snapshot shows a possible project file structure of a Universal Windows app.
Let us see briefly what all things go into each folders.
- Controls: Reusable UI controls (application independent views) without view models. Platform specific Controls are added directly to the specific project and Shared controls are added in the Shared Project.
Strings: Classes and resources for application localization
en-US: Separate directory for every supported language.
- Models: Model and domain classes
ViewModels: View models classes
- Converters: This folder includes the Value Converters. Follow this article to see how Converters can be used in Windows apps.
- Themes: It contains Theme Resources that is Resource Dictionary. Platform specific resources are added directly to the specific project and Shared resources are added in the Shared Project.
- Services: This could include classes for web service calls, navigation service etc.
- Utils: It includes all utility functions that would be used across the app. This may include
Views: Contains the views. Platform specific Views are added directly to the specific project and Shared Views are added in the Shared Project.
As shown in the list, the name of a view should end with its type:
- Window: A non-modal window
- Dialog: A (modal) dialog window
- Page: A page view (mostly used in Windows Phone and Windows Store apps)
- View: A view which is used as subview in another view, page, window or dialog
The name of a view model should be composed of the corresponding view’s name and the word “Model”. The view models are stored in the same location in the ViewModels directory as their corresponding views in the Views directory.