Prism 5.0 for WPF and .NET 4.5 Just Released

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.

Comments

  • Anonymous
    April 30, 2014
    You now download the pdf for Prism 5.0 at http://aka.ms/prism-wpf-pdf.
  • Anonymous
    April 30, 2014
    The comment has been removed
  • Anonymous
    May 02, 2014
    Why did you removed Silverlight from 5.0?
  • Anonymous
    May 03, 2014
    Finally, Prism for WP8 :)
  • Anonymous
    May 05, 2014
    Georges, we will consider this for our next release.
  • Anonymous
    May 06, 2014
    Prism.UnityExtensions now supports Unity 3.5. You can download the latest from NuGet or get the source code from http://aka.ms/prism-wpf-code.
  • Anonymous
    May 08, 2014
    The Prism.Interactivity NuGet package needs to somehow provide System.Windows.Interactivity.dll
  • Anonymous
    May 08, 2014
    Popin,Our goal was to release versions of Mvvm and Event Aggregator as portable class libraries. Additionally we had limited budget and time for the release. So given our budget and time constraints we decided to include WPF in Prism 5.0. Prism 4.1 supports Silverlight 5.0 and is available to use.Blaine
  • Anonymous
    May 08, 2014
    Sean,Thanks for the suggestion. We will update the Prism.InteractivityNuGet package to depend on the System.Windows.Interactivity NuGet package.blaine
  • Anonymous
    July 14, 2014
    I'm trying to find a tutorial getting started with Prism Library using Managed Extensibility Framework but I couldn't find it anywhere. Is there any tutorial on Prism + MEF out there?
  • Anonymous
    July 15, 2014
    Budi,I'm trying to find a more detailed walk through using MEF. In the meantime, you can look at the StockTrader Reference Implementation as it uses MEF. Additionally there is a hello world quickstart that walk you through getting started. This is the documentation link --> msdn.microsoft.com/.../ff921141(v=pandp.40).aspx. You will need to use the MEFBootstrapper instead of UnityBootstrapper.Blaine
  • Anonymous
    July 16, 2014
    Hi,do we have any pictorial representation like this ("msdn.microsoft.com/.../ff921120(v=pandp.20).aspx") for Prism 5.0 and prism 5.0 with MVVM. because pictures will tell more in detail. please let me know if it was available in MSDN site.ThanksNavin
  • Anonymous
    July 17, 2014
    Navin,I assume you mean this link ("msdn.microsoft.com/.../ff921120(v=pandp.40).aspx"). Correct?If so, we took this diagram out when we created Prism 4.0. If this is not correct can you send me the link again as the link you provided no longer exists.Thanks.blaine
  • Anonymous
    July 18, 2014
    Blaine,looks like the link what i have give was broken try this link "http:// msdn . microsoft . com / en - us / library / ff921120 ( v = pandp . 20 ) . aspx " i have pasted the link with space so that the link will not be converted to Hyperlink text please replace the white spaces.or search for "Development Activities" under Prism 2.x tree in MSDN. in this tab you will see a image the image title says "Figure 1 illustrates the mapping of composite application concepts to How-to topics included with the Composite Application Guidance.". but i can't find this type of concept diagrams in any of the prism version. can you please help me to get one like this? or let me know the link which has one like this in MSDN
  • Anonymous
    September 09, 2014
    The comment has been removed