Navigated page is bank- Content is not loaded

Im trying to load the a main page after the login page on login button click but the main page is loaded without any content (blank). If I try to load the main page instead the login page on App start the page loads with the content without any issues.

My requirement is to load the mainpage after login page without the navigation panel.

Please assist.

public App()
MainPage = new LoginPage();
//MainPage = new NavigationPage(new LoginPage()); //Tried this method but no luck


            if (logintrue == true)
                App.Current.MainPage = new MainPage();
                //await Navigation.PushAsync(new MainPage());               //Tried this method but no luck
                //await Navigation.PushModalAsync(new MainPage());          //Tried this method but no luck


  • chetanrawatchetanrawat ✭✭✭ USMember ✭✭✭

    Can you please share main page code?

  • RasikauRasikau ✭✭ Member ✭✭

    Dear chetanrawat,
    Below is the code behind and the AXML.

    public partial class MainPage : ContentPage
        public MainPage()
            Debug.Write("Page Loaded");

    <?xml version="1.0" encoding="utf-8" ?>

            <Label Text="Main Page"
                HorizontalOptions="CenterAndExpand" />

  • PaulNTUPaulNTU ✭✭✭ USMember ✭✭✭

    @Rasikau Where is your "if(logintrue == true)" code located? Is it in a separate thread (in an async method) or in the constructor for the loginpage.cs?

Sign In or Register to comment.