0

When I add loading and login pages to the Shell like this:

    <!-- Loading/Start Page -->
    <ShellItem Route="loading">
            <ShellContent ContentTemplate="{DataTemplate pages:WelcomePage}" />
    </ShellItem>

    <!-- Login and Registration Page -->
    <ShellContent Route="login"
                  ContentTemplate="{DataTemplate pages:LoginPage}">
    </ShellContent>

It works, but pages are also added to Shell flyout items as item without name, but when I press it I go back to Loading or Login page ...

I cannot figure out how to fix this ...

Do somebody faced with the same issue ?

Cfun
  • 8,442
  • 4
  • 30
  • 62
Denis Kotov
  • 857
  • 2
  • 10
  • 29

2 Answers2

2

If you want a Shell item that is in your AppShell not to be created as a flyout item, then you need to set the attached property Shell.FlyoutItemIsVisible to false, it default value is true.

 <!-- Loading/Start Page -->
    <ShellItem Route="loading" FlyoutItemIsVisible="False">
            <ShellContent ContentTemplate="{DataTemplate pages:WelcomePage}" />
    </ShellItem>

    <!-- Login and Registration Page -->
    <ShellContent Route="login" FlyoutItemIsVisible="False"
                  ContentTemplate="{DataTemplate pages:LoginPage}">
    </ShellContent>

Note

This property is available starting from Xamarin.Forms 5.0.0.2012

Related question

How can you restrict/control the navigation routes the user can visit based on login status/role?

Cfun
  • 8,442
  • 4
  • 30
  • 62
0

In such a case we always set the LoginPage as the MainPage of the whole app firstly .

MainPage = new LoginPage();

And set it as Shell when finish login .

Application.Current.MainPage = new YourShell();
Lucas Zhang
  • 18,630
  • 3
  • 12
  • 22