3

I need to use Prism. (I need composite UIs). But from a demo of MVVM Light it looks cool.

Can the two work together? Or is that a bad idea?

Can anyone show me an example of how to make them work together?

I want prism for Composite UI and MVVM Light for the MVVM side of things.

Vaccano
  • 78,325
  • 149
  • 468
  • 850

3 Answers3

11

Yes, they work together fine

They're both frameworks libraries, so you can pick and choose which pieces you want out of both. For example, I like to use Prism's NotificationObject (ViewModelBase), but MVVM Light's Messenger (event system for communication between view models).

Sometimes I'll even use both Prism's DelegateCommand and MVVM Light's RelayCommand in a project, even though they both are for the same thing (the main difference between the two is you have to manually raise the CanExecuteChanged() on DelegateCommand, whereess a RelayCommand does that automatically and sometimes more often then necessary)

Rachel
  • 130,264
  • 66
  • 304
  • 490
  • thanks for very useful comment. Do you know an analogue for MVVM Light's Messenger in PRISM? I'm new in PRISM, but basically only Messenger makes my keep references to both frameworks in my project. – Alex Klaus Apr 11 '13 at 06:30
  • 2
    Hi @Klaus, PRISM has an `EventAggregator` class which works like MVVM Light's `Messenger`. I find it a bit more complicated than the `Messenger` and it took me longer to figure out, but if you're interested I have a [helper class on my blog to simplify using the `EventAggregator`](http://rachel53461.wordpress.com/2011/10/09/simplifying-prisms-eventaggregator/) that might help. – Rachel Apr 11 '13 at 12:01
4

We are using PRISM in our project. Though PRISM can work with a complimentary frameworks like MVVM light and some of them are arguably "better" to what PRISM components, as a whole solution PRISM works very well. Also I believe it is simpler to use one technology in a project if there is no compelling reason to do otherwise.

One advantage of using PRISM is the tutorials and help to learn the technology is very good. Any new comer to the team should find it relatively easier to grasp the concepts.

Have a look at similar question MVVM Light + Unity or Prism?

Community
  • 1
  • 1
Jimmy
  • 3,224
  • 5
  • 29
  • 47
3

Prism and MVVM light are both MVVM frameworks, so it makes sense to use one or the other.

TheCodeKing
  • 19,064
  • 3
  • 47
  • 70
  • what problems has using them together caused you? – Jake Berger Mar 15 '12 at 16:12
  • 1
    I haven't personally used them together. They are both frameworks that implement the same pattern so my advise is pick one. Whereas the other answer suggests they do work in parallel I just wouldn't sleep at night mixing frameworks in this manner. I see this being more difficult to maintain, more difficult for new comers to pick-up and increases risk from future updates breaking compatibility. – TheCodeKing Mar 15 '12 at 21:37