Search code examples
wpfmvvmprism

What is Prism for WPF?


I've come across something called Prism a lot recently. Microsoft, who run the project, describe it as

Guidelines for composite applications in WPF and Silverlight.

Even after reading the more detailed descriptions out there, I have next to no clue what it's actually about, I'm afraid.

I'm hoping here that someone could give me a clear succinct explanation of what Prism actually is and why I should learn it. I have been a WPF developer for a couple of years now, used MVVM my fair share, and have lately encountered people using Prism, but personally feel a bit out of the loop here.

In particular, I'm wondering about the following points:

  • Is Prism literally just (or mainly) a booklet, as given on the MSDN site? Does it include any libraries, if so for what exactly?

  • Is Prism an MVVM framework? Should I be using it as the "official Microsoft MVVM framework" over others out there or my own?

  • Does it provide dependency injection? Does it relate to MEF at all in this way?

  • Anything else I should know about what Prism does, as a WPF/Silverlight developer.


Solution

  • Prism is the Microsoft Patterns and Practices Team official guidance for building "composite applications" in WPF and Silverlight.

    It's intended to provide guidance on the best practices for building large scale applications which are flexible in terms of development and maintainability.

    This includes guidance on dependency injection (via Unity or MEF), layout (including using MVVM), composite event handling, etc.


    Is Prism literally just (or mainly) a booklet, as given on the MSDN site? Does it include any libraries, if so for what exactly?

    It is a book, but also includes the libraries for support (on the GitHub site).

    Is Prism an MVVM framework? Should I be using it as the "official Microsoft MVVM framework" over others out there or my own?

    Yes and no. It includes guidance for using MVVM, but is far more than an MVVM framework. It's really not, in and of itself, an "MVVM framework" - though it does include MVVM guidance.

    Does it provide dependency injection? Does it relate to MEF at all in this way?

    Yes. It originally included Unity, but the latest release includes using MEF for DI.

    Anything else I should know about what Prism does, as a WPF/Silverlight developer.

    It's worth taking a look at how they do things. They have a very elaborate "region" concept, as well as good event aggregation support. It also includes good practices for developing against WPF, Silverlight, and Windows Phone simulataneously.