3

I'm having some conceptual issues with the Maui AppShell. When I start my application, I want to present my users with

  1. The login page if they're not authenticated.
  2. The onboarding page if they're authenticated, but haven't filled in basic info.
  3. Otherwise, the main view

But the AppShell seems pretty static:

<Shell x:Class="ThetaRex.OpenBook.Demo.AppShell"
       Shell.FlyoutBehavior="Disabled"
       xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
       xmlns="http://schemas.microsoft.com/dotnet/2021/maui">
    <ShellContent ContentTemplate="{DataTemplate MainView}"/>
</Shell>

How does one use the AppShell to programmatically navigate to a page when the application starts?

Quark Soup
  • 4,272
  • 3
  • 42
  • 74
  • 2
    Because the user won't access login page from the shell's flyout, I recommend finding `MainPage = new AppShell();` in `App.xaml.cs`. There, when not authenticated, set `MainPage = new LoginPage();`. When Login succeeds, in an appropriate LoginPage method, do `Application.Current.MainPage = new AppShell();` to start the AppShell. This keeps login process apart from appshell. Similar to Xamarin, so can google `xamarin shell login page` for examples. – ToolmakerSteve Aug 25 '22 at 20:33

0 Answers0