Why Use Prism?

azamsharp picture azamsharp · Jul 13, 2009 · Viewed 9.2k times · Source

I am interested in making a decent WPF application which will be pretty huge. Someone suggested using PRISM which we are currently looking into. We might be using the MVVM pattern to implement this application. I saw some PRISM screencasts and it seems like PRISM is mainly used to inject the regions with different views. Is that the main purpose of using PRISM?

I can always use WPF MasterPages using ContentPresenter so why should I use PRISM for the region purpose?

Answer

Denis Troller picture Denis Troller · Jul 13, 2009

Prism offers a bit more than the region system. Not exhaustively:

  • the View-Model command system
  • Event aggregator, for decoupled event handling (with a lot of options built-in, such as GUI thread calling, weak references etc)
  • a standard way to load modules, if you need that kind of flexibility

The region system is also more than simply a "content presenter wrapper". It can be used to "push" (put a view into a region) or "pull" (let modules declare which region they populate). It also support much more than simple contentpresenter regions (ItemsControl based regions for example) and is extensible through region adapters.

Last, but maybe not least, when you adopt Prism's formalism, you bet on a common "language" (and almost framework, even if the prism team doesn't call it like that) that outsiders may already know, instead of re-inventing your own which would require someone to learn a whole new set of things. It can be a good thing for a long-lived project (provided Prism does not die too young obviously).