We are pleased to announce that the Microsoft patterns & practices team just released the Prism Library for WPF and .NET 4.5. As I mentioned when we started the project. the major themes of the release are:

  • Provide Portable Class Library version of Prism library (where reasonable)
  • Address high priority items identified on the CodePlex site.

Providing PCL versions of the MVVM and Event Aggregator projects will help you create companion and/or convergent applications. This release is the first step in supporting these scenarios. We still have work to do before completely supporting these scenarios. I discuss what’s next later in this post. The other advantage is that more platforms can take advantage of improvements we make to the library. For this release we were able to harvest the View Model Locator and BindableBase from Prism for Windows Runtime and add it to the MVVM project. We also integrated the Property Support class Prism for WPF with the BindableBase class making it more functional.

What’s New is Prism 5.0?

When we first created Prism one of the primary goals was to allow you to use the components that you want. For this release we took it a step farther by separating the features into separate assemblies – Prism.Composition, Prism.Mvvm, Prism.PubSubEvents, and Prism.Interactivity.

Prism Assembly

The Prism assembly no longer exists, instead that functionality has moved into the assemblies mentioned above. If you want to use all the Prism functionality, you can download the Prism NuGet package which will download the NuGet packages for Prism.Composition, Prism.Mvvm, Prism.PubSubEvents, and Prism.Interactivity.

Prism.Composition

  • Assembly contains the Prism.Logging, Prism.Modularity, and Prism.Regions namespaces. 
  • The Prism.Events namespace exists in this assembly but it has been marked as Obsolete because we want you to move to the Prism.PubSubEvent  PCL version of the classes.
  • The Prism.ViewModel namespace also exists in this assembly but the NotificationObject and PropertySupport classes are marked obsolete because we want you to move the Prism.Mvvm PCL version of the classes.
  • UriQuery class was renamed to NavigationParameters, it keeps the same functionality as before
  • NavigationParamaters class can now be used to pass object parameters during navigation using the overloads of the RequestNavigate method of a Region or RegionManager instance. This was a community requested on CodePlex.

Prism.Mvvm

  • Portable class library that encapsulates Prism’s MVVM support including DelegateCommand, CompositeCommand, and ViewModel. This allows your view models to be portable across WPF, Windows Phone 8, and Windows Store 8.1.
  • Views and view models can be wired together using the new ViewModelLocationProvider’s convention-based approach. View model construction can still be accomplished using a dependency injection container. We migrated the View Model Locator that we developed in Prism for Windows Runtime to the Prism.Mvvm project.
  • BindableBase class provides a new implementation of the INotifyPropertyChanged interface. We decided to take BindableBase from the Prism.StoreApps because it already supported CallerMemberName attribute with INPC.
  • NotificationObject and PropertySupport classes are marked obsolete in the Prism.Composition assembly. You should use BindableBase instead of NotificationObject and you should use SetProperty to update the property’s backing field when inheriting from BindableBase.
  • DelegateCommands are now extendable and provide Async support.
  • Execute and CanExecute methods on DelegateCommand are now marked virtual.
  • WeakEventHandlerManager is now public

Prism.PubSubEvents

  • Portable class library that allows your view model to be portable across WPF, Windows Phone 8, and Windows Store 8.1.
  • EventAggregator classed moved to this library

Prism.Interactivity

  • Prism Interactivity contains extensions to the Blend SDK
  • PopupWindowAction class added to allow a custom window to display in response to interaction request being raised.
  • The InvokeCommandAction provided by Prism now passes trigger parameter's to the associated command. This was a community request on CodePlex.

Code Samples

We created the Interactivity QuickStart in this release to demonstrate how views and view models can interact with the user. This includes interactions triggered from the view model and interactions fired by controls located in the view.

We also migrated the Silverlight QuickStarts to WPF:

CodePlex Issues Resolved

  • 8532: InteractionRequestTrigger can cause memory leaks with some implementations.
  • 9153: 'Notification' really should be an interface.
  • 9438: Navigation to an existing view.
  • 5495: Event to Command.
  • 8101: DelegateCommand is not extendable.
  • 5623: Make WeakEventHandlerManager public.
  • 9906: A bug when using XAML module catalog in WPF.
  • 7215: Issue with ModuleCatalog.CreateFromXaml for WPF application with MEF Bootstrapper.
  • 8703: RegionManager::IsInDesignMode.
  • 4349: Default Region Behavior Order Problem.
  • 3552: Region manager in V2 fails to recognize non-WPF applications.

Where to Get It?

Documentation

Source Code

Binaries

Where to Start?

Where to start depends on your goals and what you already know.

Learn: If you are new to Prism, this is a good place to start.

Develop and Deploy Applications: If you want to create a Prism Hello World application and deploy it then go through these topics. If you want to more fully understand how to utilize specific Prism capabilities in your application then read the Prism Landing Page.

Upgrade from Prism 4.1: Read the topics below so you can perform a cost benefit analysis of upgrading to Prism 5.0.

What about .NET 4.0, Silverlight, or Windows Phone 7

If you are developing for .NET 4.0, Silverlight, or Windows Phone 7, you should continue using Prism 4.1.

Documentation

Code

What happened to Prism 4.2?

We decided to change the version to 5.0 because there are breaking changes with this release. The breaking changes include:

  • Reference changes – Prism reference changes to Prism.Composition, Prism.Interactivity, Prism.Mvvm, and Prism.PubSubEvents
  • Removal of Silverlight

What’s Next?

Windows Phone 8.1 and Windows Store 8.1

We will create a version of Prism that  allows you to reuse code from apps that run on Windows Phone 8.1 and Windows Store 8.1. We will start with the Prism.StoreApps, Prism.PubSubEvents, and Prism.Mvvm projects and use the Universal project with the new version of Visual Studio. We will provide updates as we go. These are often referred to as Universal or Convergent Apps. The first drop is available on CodePlex.

Prism Apps for WPF and Windows Runtime

We are considering creating guidance on how to take your Prism for WPF and/or Silverlight applications and create Companion Apps on Windows Phone and Windows Store. I’ve had a number of developers ask if there is a way to preserve your investment in creating Prism apps that use modules and regions on the Windows Runtime. This is an area we are considering exploring.

The other request I’ve heard from a number of you is how to use modular development for apps that run on Windows Runtime.

If you have other suggestions please let me know.