Prism 4.0 Template Pack Now Available
The updated version of the Prism Template Pack for Prism 4.0 is now available here!
The Prism 4.0 Template Pack contains Prism shell and module project templates and a quick-start solution template which creates a multi-project solution with a shell and two modules. All templates are available for both Silverlight and WPF and for C# or Visual Basic.NET.
The templates are deployed as a vsix package. Downloaded the template pack from here and then rename the file to remove the .zip file extension. Double click on the Prism.TemplatePack.1.3.vsix file, review and accept the license agreement, and the templates will be installed and available in the Visual Studio New Project Dialog under the Prism node. Release notes for the template pack are available here.
Prism 4.0 (also available on MSDN here) ships with signed binary assemblies. You can register these assemblies with Visual Studio by running the RegisterPrismBinaries.bat batch file. This allows Visual Studio to automatically resolve all assembly references in the newly generated projects. If you have built the Prism assemblies yourself you will have to manually fix up the project references to point to the Prism assembly locations on your system. Remember, for Silverlight projects, you will have to manually create Silverlight Application References in the Web project so that the shell and two modules XAP files are deployed to the hosting web site.
A Quick Tour
The templates provide boiler-plate code that demonstrates many of the features provided by Prism, including:
- The Model-View-ViewModel (MVVM) Pattern
- Dependency Injection using Unity
- Interaction Requests
- Loosely coupled events using the Event Aggregator
The quick start solution templates creates a simple multi-module Prism solution that shows all of these features working together. You can use this template to create a simple but working end-to-end application which you can evolve to your own requirements. For this release, I have updated the quick start solution quite a bit to illustrate some of the new features available in Prism 4.0, including those that support the MVVM pattern and region-based navigation.
The solution consists of two modules that are loaded into a shell that uses a tab control to organize views in the main region on the right. Module 1 provides a collection of data items that are displayed in a list box using a collection view. The user can use commands to navigate to views which are then displayed as tabs in the main region. Module 2 provides a single view that responds to loosely-coupled events that are fired when the user selects an item in Module 1’s list view.
The solution shows how to use some of the more advanced features of Prism’s region navigation support. Clicking on the arrow button for an item causes an Edit View for that item to be displayed in the main region. The Edit View uses an interaction request to prompt the user if they decide to navigate away from that view. The other button causes the Details View to be displayed. This view is re-used and updated to display the corresponding item. The navigational behavior of the views are defined by the INavigationAware and IConfirmNavigationRequest interfaces implemented by the view model classes.
I’ve tested the templates extensively but if you find anything that needs fixing or improving, please let me know. If everything is ok, I’ll put the template pack in the Visual Studio Code Gallery to make them available from within Visual Studio’s Extension Manager directly…