How can i navigate a content page to shell page?

Saurabh Sharma 1 Reputation point

I made an app through xamarin in which i made a login page(content page) then i wanted it to navigate on a shell page through my login button but shell page is not opening and giving errors that push modal async doesn't work on this ! Kindly help regarding this how can I navigate a content page to shell page

A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
4,934 questions
No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Gary Lewis 256 Reputation points

    I wrote an OnBoarding page and then transitioned to Shell. You can't jump into the middle of a bunch of Shell pages, but you can transition from standard navigation to Shell.

    In my App.xaml.cs file I did this:

        MainPage = new NavigationPage( new SplashView() );

    Then in the code-behind of my SplashView, I did this:

      public partial class SplashView : ContentPage
            public SplashView()
            protected override async void OnAppearing()
                await Task.Delay( 2000 );
                await Application.Current.MainPage.Navigation.PopAsync();
                Application.Current.MainPage = new AppShell();
  2. JarvanZhang 23,866 Reputation points


    Welcome to our Microsoft Q&A platform!

    Hi, @Saurabh Sharma . For this function, you could detect the login status to specify the MainPage. And set the AppShell as the MainPage instead of using the navigation method after logining in.

       public class App : Application  
           public static bool IsUserLoggedIn { get; set; }  
           public App()  
               if (!IsUserLoggedIn)  
                   MainPage = new Login(); //login in and then set the AppShell as MainPage  
                   MainPage = new AppShell();  

    Best Regards,

    Jarvan Zhang

    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.