Forum Xamarin.Forms

"logout" from MasterDetailPage

Good morning,

I'm following the pattern from the master detail page tutorial, implementing the whole "hamburger menu", etc.

My question: In the navigation page, I need to add a "logout". The only way I can think of doing it is by adding another view called "logout" and by setting "App.Content.MainPage" to my LoginPag(). Please see my code:

    protected override void OnAppearing()
        App.IsUserLoggedIn = false;

        App.Current.MainPage = new NavigationPage(new LoginPage());

Is this the correct methodology to integrate logout / login w/in a master detail page?


Best Answers


  • Question: what is the difference in using new NavigationPage(new LoginPage()) vs new LoginPage()?

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭
    The difference is that I think you should not add your login page to a navigation stack. You don need to go back to a login page pressing a back button...
Sign In or Register to comment.