次の方法で共有


Prism 4.0 Template Pack Now Available

QuickStart.Silverlight.2-300The 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.

Note: To use the Quick Start Solution templates, you will need to have the Expression Blend SDK for Silverlight (here) and/or WPF (here) installed.

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
  • Modularity
  • Commands
  • Interaction Requests
  • Regions
  • Navigation
  • Loosely coupled events using the Event Aggregator

imageThe 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…

Comments

  • Anonymous
    January 16, 2011
    Good! I'll give it a try! Cheers!

  • Anonymous
    January 16, 2011
    For those of you without Expression Blend, you will see three errors - the first of which is "The property 'Triggers' does not exist on the type 'Grid' in the XML namespace".  To resolve, install "Microsoft Expression Blend Software Development Kit (SDK) for Silverlight 4" from www.microsoft.com/.../details.aspx Thought I'd share the solution given that this doesn't appear here or in the Release Notes.

  • Anonymous
    January 17, 2011
    Thanks Steven - you're right; the Blend SDK is required because the templates use some of the blend behaviors. I'll update the post and the release notes. Thanks for catching this and letting everybody know. David.

  • Anonymous
    January 17, 2011
    Are the templates in VB.Net too?

  • Anonymous
    January 18, 2011
    The comment from Steven applies to Silverlight ... In case you're trying out the WPF QuickStartSolution, you'll need the Expression Blend WPF SDK from www.microsoft.com/.../details.aspx

  • Anonymous
    January 20, 2011
    This is a very nice prism mvvm solution!  Well done! Going to use it on www.prismforsilverlight.com. Michael

  • Anonymous
    January 23, 2011
    Thanks for sharing the template.

  • Anonymous
    February 02, 2011
    Awesome!! Any chance there will be a version for MEF?

  • Anonymous
    February 09, 2011
    Awesome!!!!!!!!!! Any chance there will be a version for MEF??? CI

  • Anonymous
    February 10, 2011
    I am new to Prism but I have all the pre-reqs but after creating the PrismQuickStart solution and projects from the template pack it throws an ModuleTypeLoaderNotFoundException for Modeul1.   I have the prism libraries registered using the RegisterPrismBinaries.bat file. I have Blend 4 installed an I am using VS2010 Ultimate. Since I am new to Prism and I was going to use this Solution to help me start to learn it, I am not sure where to start with this exception.

  • Anonymous
    February 10, 2011
    Update... for some reason the Shell project has no reference to Module1 project. So the exception now makes since, but not sure why the template would create the Shell project which has a ModuleCatalog creating setting a DependsOn for Module1 and not having a reference to it.   SO when I add the reference it runs and works, my question is then should Shell have a reference to Module1 or is there something else wrong here?

  • Anonymous
    February 12, 2011
    Why do I get this error( http://tinyurl.com/4kn4w5w ) on building the c# prism module project and how do I solve that? Thank you.

  • Anonymous
    February 21, 2011
    OK, I installed everything including the Blend SDK, but am still getting: Error 1 The property 'ItemContainerStyle' does not exist on the type 'TabControl' in the XML namespace 'www.codeplex.com/prism&. Error 2 The tag 'InteractionRequestTrigger' does not exist in XML namespace 'www.codeplex.com/prism&. Error 3 The tag 'PopupChildWindowAction' does not exist in XML namespace 'www.codeplex.com/prism&. What did I miss? TIA

  • Anonymous
    February 22, 2011
    These are good project templates and are helping me to dive in to Prism. One thing I am struggling with is understanding MEF vs. Unity and what Prism adds to these. What I am trying to do is build the modules and then drop them in to a directory. The shell then needs to discover these at run-time. I am playing with WPF first. Is there an "easy" way to do this with Prism and with your shell template? Thanks in advance for any help.

  • Anonymous
    February 24, 2011
    Just what I was looking for. Much appreciated :)

  • Anonymous
    March 01, 2011
    So, what about MEF templates?