C
C#2y ago
Denis

❔ 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
Trinitek
Trinitek2y ago
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
Trinitek
Trinitek2y ago
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
Buddy
Buddy2y ago
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.
Denis
DenisOP2y ago
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
Trinitek
Trinitek2y ago
there was a name change
Denis
DenisOP2y ago
ah
Trinitek
Trinitek2y ago
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...
Denis
DenisOP2y ago
and does it offer custom IoC?
Trinitek
Trinitek2y ago
no, it is very very simple oh no one moment oh, just as I thought
Trinitek
Trinitek2y ago
Ioc - Windows Community Toolkit
An introduction to the use of the IServiceProvider type through the Microsoft.Extensions.DependencyInjection APIs
Denis
DenisOP2y ago
I do really want to keep things simple, and it's nice to see that this is recommended for .NET
Trinitek
Trinitek2y ago
it just relies on the basic built-in DepencencyInjection package
Denis
DenisOP2y ago
And Reactive UI for WPF? Since its a company project, they wish to stay away from a non-official UI framework
Trinitek
Trinitek2y ago
ReactiveUI is a fine choice for WPF I'm using it in production now
Denis
DenisOP2y ago
I've tried reactive UI to solve issue with displaying collections that were updated in real time from multiple threads
Trinitek
Trinitek2y ago
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.
Denis
DenisOP2y ago
yes, this is the one
Trinitek
Trinitek2y ago
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
Denis
DenisOP2y ago
and any thoughts on MvvmCross?
Trinitek
Trinitek2y ago
no experience, and I've never heard anyone talk about it
Buddy
Buddy2y ago
Never heard of MvvmCross unfortunately
Denis
DenisOP2y ago
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?
Buddy
Buddy2y ago
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
Denis
DenisOP2y ago
Alrighty, thanks a ton!
Accord
Accord2y ago
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.
Want results from more Discord servers?
Add your server