Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Use Prism?

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?

like image 507
azamsharp Avatar asked Jul 13 '09 14:07

azamsharp


People also ask

Where is prism used?

Prisms are heavily used in optical applications such as microscopes, lenses, telescopes and laser diodes. Other examples include: Interferometry. Pattern recognition.

Who needs prism glasses?

Eye doctors usually recommend prism glasses to patients who struggle with double vision, blurred vision, headaches, or other symptoms caused by slight eye misalignment. Prism correction helps correct eye alignment so that you only see one clear image.

What does adding prism to glasses do?

Prism lenses address double vision by bending light rays onto the retina. This allows the two eyes to now perceive the object as a single image, removing the double vision, these lenses will also correct for refractive errors, so the patient sees clearly as well.

How do you know if you need a prism?

If you have trouble reading anything for more than a couple of minutes – if you can't seem to focus, or get headaches while reading, or find that the words jump around in a blur – but you're totally fine doing other normal daily activities, you might need lenses with prisms.


1 Answers

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).

like image 178
Denis Troller Avatar answered Oct 18 '22 05:10

Denis Troller