kaycee
kaycee

Reputation: 1309

is prism a pure mvvm platform?

i'm working with WPF for quite some time now. the platform i used is MVVM Light. and i must say i don't add a single line of code in the code-behind files.

lately i dived into Prism, and i see many many examples where code-behind (such as data context, or property change events) is a matter of course.

is Prism considered as pure mvvm platform ?

although the implementation of IoC this still break the rules of mvvm:

[Import]
public MainViewModel ViewModel
{
    set { DataContext = value; }
}

Upvotes: 1

Views: 211

Answers (3)

Vladimir Dorokhov
Vladimir Dorokhov

Reputation: 3839

Prism is a framework to build complex, composite applications which base on recommended practicies from Microsoft. MVVM is one those practice, the other one is modularity of application. That's why you can see an applicaiton which uses Prism but not follows MVVM - it just has modularity structure and uses Prism to lazy module downloading, declarative module including etc.

But Prism is excellent MVVM framework itself. It provides implementation of base MVVM patterns:

  • base view model - NotifyProertyChangesBase
  • command - DelegateCommand
  • notification between view models (for composite applications) - EventAggregator
  • abstraction over user notification which can be used on view model level - Notification
  • respects DI principle for unit testing of view models
  • extentended ability to map view model to view - Regions

Prism as MVVM framework is heavy for small application, but it's very powerfull and extendable and I saw good composite MVVM-designed applications which was created using Prism.

Upvotes: 1

Big Daddy
Big Daddy

Reputation: 5224

Prism is a facilitator of MVVM, not a platform. It's the role of the developer to follow the principals of MVVM. I suspect there are many Prism apps that don't follow the principals of MVVM. I've even worked on one.

Upvotes: 0

RoelF
RoelF

Reputation: 7573

No, Prism is a Composite Application platform (if platform is the correct name, probably Library is better).

The fact that you want to use MVVM has nothing to do with Prism itself. You can use MVVM and Prism together.

Upvotes: 1

Related Questions