mavvm is a framework for .NET MAUI and Shell. It allows you to use the MVVM architecture you know and love from Xamarin applications with minimal configuration and overhead.
Use the package manager to install mavvm.
Install-Package mavvm
It is important to use Shell! Click here to learn how to use it.
As you can see from the tables below, the configuration is minimal.
- ShellContent does not need a route property anymore. It only needs the corresponding ViewModel and will create the Route and BindingContext by itself.
- In
MauiProgram.cs
you need to changebuilder.Build();
tobuilder.BuildWithContainer();
to make sure that the container is registered and can be used by mavvm. - Also in
MauiProgram.cs
you need to add every Page in your App with the corresponding ViewModel using the.AddRoute<TView, TViewModel>()
extension.
Old (AppShell.xaml) | New (AppShell.xaml) |
|
|
Old (MauiProgram.cs) | New (MauiProgram.cs) |
|
|
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.