Skip to content

Shell | Getting Started

Make .NET MAUI Shell shinier with viewmodel lifecycle management, navigation, and source generation to remove boilerplate, reduce errors, and make your app testable.

Inspired by Prism Library by Dan Siegel and Brian Lagunas.

  • Navigation service — route-based and ViewModel-based navigation with INavigator
  • ViewModel lifecycle — appearing/disappearing, navigation confirmation, navigation awareness, and disposal
  • Auto BindingContext — ViewModels automatically attached to page binding contexts
  • Source generation — eliminates route registration boilerplate, generates strongly-typed navigation extensions and DI registration
  • No special AppShell — works with the default MAUI AppShell, no subclass required
  • TestableINavigator is injectable and mockable for unit testing
  1. Install the NuGet package

    Terminal window
    dotnet add package Shiny.Maui.Shell
  2. Configure UseShinyShell in your MauiProgram.cs

    public static class MauiProgram
    {
    public static MauiApp CreateMauiApp()
    {
    var builder = MauiApp.CreateBuilder();
    builder
    .UseMauiApp<App>()
    .UseShinyShell(x => x
    .Add<MainPage, MainViewModel>(registerRoute: false)
    .Add<AnotherPage, AnotherViewModel>("another")
    )
    .ConfigureFonts(fonts =>
    {
    fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
    fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
    });
    return builder.Build();
    }
    }
  3. Inject INavigator into your ViewModels and navigate

    using Shiny;
    public class MainViewModel(INavigator navigator)
    {
    public async Task GoToDetails()
    {
    await navigator.NavigateTo("another");
    }
    }
// Navigate by route with arguments
await navigator.NavigateTo("details", ("Id", 42));
// Navigate by ViewModel with strongly typed setup
await navigator.NavigateTo<DetailViewModel>(vm => vm.Id = 42);
// Go back with arguments
await navigator.GoBack(("Result", "saved"));

An AI skill is available for Shiny MAUI Shell to help generate pages, ViewModels, navigation, and source-generated routes directly in your IDE.

Claude Code

Terminal window
claude plugin add github:shinyorg/skills

GitHub Copilot — Copy the shiny-maui-shell skill file into your repository’s custom instructions.