❔ Choosing an MVVM Framework - Prism vs MvvmCross
Hello! I'm researching MVVM frameworks for a new large project with a complex UI. I'd like it to be UI framework agnostic, in case WPF (which will probably be the target UI framework of the project) is buried by Microsoft.
Additionally, I'd like to be free to choose whichever IoC I want, e.g., DryIoC
To this day I was not using any frameworks for MVVM.
I've noted the following potential frameworks:
- Prism
- MvvmCross
- ReactiveUI
Could you please share your experience with said frameworks, and, if possible, why you chose one over the other?
-- Here are my quick notes:
Prism is one of the most popular MVVM frameworks, that offers many features necessary for large-scale applications. This means reading the documentation is necessary, but less overall boilerplate code is written. Moreover, Prism has native support for DryIoc and Unity. The framework had been out for quite a while.
MvvmCross is easy to start working with. Everything works out of the box but allows developers to override features to their needs. The documentation might not be up to date. It is very similar to Prism.
ReactiveUI is a powerful library focused on simplifying updates to the view by making it “reactive” to changes made in the view model. This means that it is much easier to use for e.g. displaying stock exchange prices, which change constantly, or logging. The project is very popular and actively developed.
26 Replies
My research sources:
https://github.com/rogerwcpt/xamarin-mvvvm-frameworks
https://www.reddit.com/r/csharp/comments/nozdxe/what_is_the_best_mvvm_for_wpf/
https://www.youtube.com/watch?v=8E000zu8UhQ
I've avoided any old sources
the most-recommended framework here is the MVVM Toolkit from Microsoft https://learn.microsoft.com/en-us/windows/communitytoolkit/mvvm/introduction
its main feature is using Roslyn source generators to create the INPC boilerplate for your properties, and it is agnostic to any dependency injection solution you want to use
Introduction to the MVVM Toolkit - Windows Community Toolkit
An overview of how to get started with the MVVM Toolkit and to the APIs it contains
Prism is usually discouraged because it can feel "enterprisey"
personally I think ReactiveUI is not a bad choice either for apps that have complex property interactions, but there is a learning curve involved because it ties in with Reactive Extensions, a separate project
Prism for me felt really overwhelming, I don't need that many things, I just want to keep it as simple as it can, yet have the underlying MVVM pattern.
I really like MVVMToolkit for MAUI and for Avalonia I go with ReactiveUI.
I was also quite overwhelmed when I've checked out Prism
I've seen the MVVM Toolkit; however, I was quite confused with the repo
moreover, I saw a deprecated package with the same name
there was a name change
ah
CommunityToolkit.Mvvm 8.1.0-preview1
This package includes a .NET MVVM library with helpers such as:
- ObservableObject: a base class for objects implementing the INotifyPropertyChanged interface.
- ObservableRecipient: a base class for observable objects with support for the IMessenger service.
- ObservableValidator: a base class for objects implementing the INot...
and does it offer custom IoC?
no, it is very very simple
oh no
one moment
oh, just as I thought
Ioc - Windows Community Toolkit
An introduction to the use of the IServiceProvider type through the Microsoft.Extensions.DependencyInjection APIs
I do really want to keep things simple, and it's nice to see that this is recommended for .NET
it just relies on the basic built-in DepencencyInjection package
And Reactive UI for WPF?
Since its a company project, they wish to stay away from a non-official UI framework
ReactiveUI is a fine choice for WPF
I'm using it in production now
I've tried reactive UI to solve issue with displaying collections that were updated in real time from multiple threads
for collections specifically, there is https://github.com/reactivemarbles/DynamicData/ which is yet another separate library
GitHub
GitHub - reactivemarbles/DynamicData: Reactive collections based on...
Reactive collections based on Rx.Net. Contribute to reactivemarbles/DynamicData development by creating an account on GitHub.
yes, this is the one
so if you go with RUI, you're possibly going to be learning 3 things: RUI, Reactive Extensions, and DynamicData
can be very steep depending on what you need to do
and any thoughts on MvvmCross?
no experience, and I've never heard anyone talk about it
Never heard of MvvmCross unfortunately
I'm checking out the MVVM Toolkit; however, I'm having trouble finding resources. Is it safe to assume it is the same, as it was for MVVM Light?
Or it is a complete rehaul?
The source generator for MVVM Toolkit, that's what makes it so easy to get started with.
If you have experience with MVVMLight, heres how to migrate from MVVMLight to MVVM Toolkit
https://learn.microsoft.com/en-us/windows/communitytoolkit/mvvm/migratingfrommvvmbasic?source=recommendations
Alrighty, thanks a ton!
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.