Search code examples
xamarinnavigationmaster-detail

xamarin navigation - how to normally implement navigation between login and masterdetailpage


So, how do you normally implement navigation between login page and masterdetailpage.?

I tried few implementation and not really what I am looking for.

So basically, when the login is successful, themasterdetailpage should be the root navigation so if we go back /or pop, we would need to go out of the app. But at the moment, it goes back to the login page.

I tried..

using NavigationPage and InsertPageBefore the mainpage and pop so it is in the root page, but there is a catch because of the navigation tab showing on both loginpage and masterdetailpage (one tab layer for navigationpage and one extra layer of tab for master page in masterdetailpage)

I tried..

just instantiating the App.MainPage as new loginPage() without wrapping in NavigationPage, but I could not find a way to open masterdetailpage

Any help and direction is appreciated cheers,


Solution

  • You have not to add LoginPage to Navigation.

    You should

    Application.Current.MainPage = new LoginPage();
    

    after login is ok you should

    Application.Current.MainPage = new MyMasterDetailPage();