Building Windows Store apps using Prism can be a rather tedious and error prone endeavor. When using it correctly, practically all models and views have to have their base classes replaced with Prism alternatives. Even the App singleton has to be swapped out with one that derives from MvvmAppBase.
To make things easier on developers, David Britch has released a set of project and class templates for Prism and Prism with Unity. David is known for writing the documentation for the Windows RT version of Prism. And though he works with Microsoft’s Patterns and Practices team, these templates are not part of the official release.
David describes Prism for the Windows Runtime (a.k.a. Windows Store) as
Prism for the Windows Runtime provides two libraries that help developers create managed Windows Store apps:
- The Microsoft.Practices.Prism.StoreApps library provides support for bootstrapping MVVM apps, state management, validation of user input, navigation, data binding, commands, Flyouts, settings, and search.
- The Microsoft.Practices.Prism.PubSubEvents Portable Class Library allows communication between loosely coupled components in an app, thus helping to reduce dependencies between assemblies in a Visual Studio solution.
The chart below shows the common categories of classes and their Prism base class. All base classes are in the Microsoft.Practices.Prism.StoreApps namespace.
- App - MvvmAppBase
- Primary Views - VisualStateAwarePage
- Secondary Views - FlyoutView
- View-Models - ViewModel
- Models - ValidatableBindableBase
For more information on Prism check out David’s free book, Prism for the Windows Runtime.