The documentation for Prism 4 has been completely rewritten and includes the architectural overview, design, and technical concepts for composite applications, applied patterns, two chapters covering Model-View-ViewModel (MVVM), application navigation, Stock Trader Reference Implementation (Stock Trader RI) and MVVM Reference Implementation (MVVM RI) overview, QuickStart overviews, and deployment topics. Much of this guidance is applicable even if you are not using the Prism Library, but you want to know best practices for creating composite applications
The guide contains the following topics:
- What’s New in Prism 4.0
- Chapter 1: Introduction
- Chapter 2: Initializing Prism Applications
- Chapter 3: Managing Dependencies Between Components
- Chapter 4: Modular Application Development
- Chapter 5: Implementing the MVVM Pattern
- Chapter 6: Advanced MVVM Scenarios
- Chapter 7: Composing the User Interface
- Chapter 8: Navigation
- Chapter 9: Communicating Between Loosely Coupled Components
- Chapter 10: Sharing Code Between Silverlight and WPF
- Chapter 11: Deploying Prism Applications
- Patterns in the Prism Library – an overview on common patterns used in “Composite Application” & Prisim Library.
- Prism Library – the organization of the Prism Library into 4 different assemblies. (WP7 has only 2 assemblies)
- Extending Prism e.g. custom logging.
- Reference Implementations
- Appendix H: Prism Hands-On Labs
Class Library References:
This minor update of the Composite Application Guidance for WPF and Silverlight allows you to use the Composite Application Library with Silverlight 3. The following changes were implemented in this release:
- All Visual Studio projects (Composite Application Library, reference implementation, and Quickstarts) were migrated to use Silverlight 3. If you do not want to upgrade to Silverlight 3, see Opening Projects with Silverlight 2.
- TabRegionControlAdapter was modified to support binding in the TabItem‘s control header in Silverlight 3. This feature was present for Silverlight 2 but stopped working in Silverlight 3 due to a breaking change. It now supports both versions of Silverlight.
- Implemented the WeakEvent Pattern for the DelegateCommand‘s and CompositeComand‘s CanExecuteChanged event to fix a possible memory leak in the applications using the Composite Application Library commands. For more information, see Composite Application Library Command Memory Issues and Solution.
- CreateXap.bat file was modified to search for Silverlight 3 assemblies if the Silverlight 2 reference assemblies cannot be found. This is to support the infrastructure required to run the Composite Application Library unit tests. Applications already using the library will not be affected
- Part 1: Taking Sketched Code Towards Unity
- Part 2: Dependency Injection with Unity
- Part 3: Modularity with Prism
- Part 4: The Unity Bootstrapper
- Part 5: Moving to a Modular Silverlight Project
- Part 6: Shells, Regions, Views
- Part 7: Commands
- Part 8: Loosely Coupled Events with Event Aggregation
- Part 9: Sharing Data via Region Contexts
and then bring some of these concepts together in a longer, more realistic example of a simple Email application built using the Prism framework
The source code for Video 10 here for download
An Intro to Composite Applications – Eric Mork
Prism can be thought of as a set of libraries that help Silverlight applications be scalable and testable. It has a number of features (modularity, view regions and commanding) that help with this. This guide shows you how to get started writing a Prism application in Silverlight. It shows how to use the bootstrappers, modules, catalogs, regions and commanding.
How Commanding Works in Prism and MVVM– Eric Mork
Prism Commanding allows designers/develops to specify, in XAML, events that fire back into the View Model/Presenter. Imagine this: the user hovers a mouse over a Silverlight control. Commanding allows that action to be bound to a method (more specifically, a delegate) in the ViewModel. The View Model then handles that action. This Commanding support overcomes a deficiency (lack of ICommand implementation) in Silverlight that makes proper MVVM implementation difficult. If you’re using MVVM, Commanding is a must. That can take the form of a home-grown solution, Prism or any of a number of other libraries: Caliburn, Silverlight.FX, etc. In Prism Commanding, the Commands are implemented as attached properties. This video shows how to use the existing command (button click), handle command parameters, use the CanExecute functionality, and create new commands.
- Eventing in Prism – Loosely Coupled Talking – Eric MorkPrism allows us to have modular and loosely coupled applications, but how do these loosely coupled pieces communicate? That’s where Eventing and the EventAggregator come in: they provide communication channels. A way that the separate pieces of the application can safely talk back and forth. Eventing also has extra goodies (thread preference, weak references) that are built on the lessons learned from past technologies (like CAB). All around, it’s a great helper for any Silverlight/Prism (or WPF) application.
Modularity allows applications to be broken down into discrete pieces. This allows for easier testing, better maintainability and the ability to distribute an application across multiple teams. This video explores the modularity support in Prism. The first part of the video covers Unity and Unit Testing. Inversion of Control using Dependency Injection and Service Location are both covered. The second part of the video details modules and how they’re loaded by the Module Catalog.
Regions in Prism Video – Eric Mork
Regions in Prism are kind of like Master Pages. They allow us to have master and sub-views. If you’re interested in composing views separately and then bringing them together in the running application, Regions are for you. As with all of the things in Prism, Regions are a part of the buffet. You can use them or not at your discretion.
In this 4 part series, Bob Brumfield and Erwin van der Valk from patterns and practices shows you how to build a modular application using the recently released Composite Application Guidance for WPF and Silverlight – February 2009 (also known as Prism V2). Source code.
In this screencast, you will see how to divide an application into modular pieces and how to recombine them again in a shell.
This webcast demonstrates how to create placeholders for views and how to load views into them.
This webcast demonstrates how to create a view using the Model – View – ViewModel pattern, and how to create and inject Services into your classes by using the Unity Dependency Injection Container.
This webcast demonstrates how to communicate between the different modules.
Click the links above to watch the screencast.
Also, from Prism Codeplex – Learn about Prism through videos and blogs Learn Prism
Prism Quick Start Kit
A number of solution and project templates for Visual Studio that would give you a simple working app that you could tweak and modify. These would fall somewhere in-between the Quick-Starts and Reference Implementation and provide a basic solution and project structure into which you could add your application specific files.
The quick-start solution is meant to provide a basic structure for a Prism app and to include the most commonly used features of Prism. I find it very useful as a starting point because it contains all of the little code snippets and that you often need and has a basic structure in place making it pretty straightforward to take it and modify it to create many different types of applications. It’s hopefully also a good place to experiment with Prism and to learn about some of its basic features.
A series of articles about implementing the Model-View-View-Model (MVVM) architectural pattern for Silverlight/WPF. MVVM in itself is not a complex pattern, however having a framework can reduce the work required to accomplish more advanced scenarios. For example, communicating between modules in a loosely coupled way requires some sort of event framework. Prism provides this.
- Part 1: The Bootstrapper
- Part 2: The Shell
- Part 3: Regions
- Part 4: Modules
You may also interested in –> Prism for Silverlight 2: Taking ‘Hello World’ to a Whole New Level
- WCF integration
- Design-time data binding
- Independent, decoupled modules
- Commanding support