Quickstart
Configure MauiProgram.cs and launch in App.xaml.cs
MauiProgram.cs
In MauiProgram.cs configure MvvmZero and your container.
namespace SampleTabbedApp
{
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
*******************************
*** CONFIGURE MVVMZERO HERE ***
*******************************
)
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
});
#if DEBUG
builder.Logging.AddDebug();
#endif
********************************
*** CONFIGURE CONTAINER HERE ***
********************************
return builder.Build();
}
}
}Configure MvvmZero
MvvmZeroConfigure your container
Register all your Pages and ViewModels in the Container.
MvvmZero registers IPageService and NavigationPage in the container for you.
Unless you override the TypeFactory everything else MvvmZero is asked to instantiate must be registered in the container.
This includes FlyoutPage and TabbedPage if you use them.
App.xaml.cs
In App.xaml.cs
To navigate from within a ViewModel use the IPageServiceZero implementation:
Like this:
Last updated