M v v m G e n

The Next Generation MVVM library – Say Goodbye to the Boilerplate

Implementing the Model-View-ViewModel pattern (MVVM) in XAML applications like WPF, WinUI, or .NET MAUI means that you have to write a lot of boilerplate code, even if you use one of the existing MVVM libraries.

Wouldn’t it be great if that boilerplate code could get generated for you on the fly while you’re creating your ViewModel classes? Exactly this is what MvvmGen does for you: You can focus on your business logic, and MvvmGen will generate the boilerplate for you while you’re typing. MvvmGen is a modern MVVM library that is built with Roslyn-powered C# source generators.

Today you can use MVVMGen for the following scenarios

  • Generate properties in your ViewModel that wrap an underlying POCO model
  • Generate properties from fields that raise a PropertyChanged event in the setter
  • Generate Command properties from normal methods that you define in your ViewModel

More scenarios will come in the future. Beside the code generators, MvvmGen contains everything you need to build an application with the MVVM pattern: An IoC container and an EventAggregator