Olorunniyi Ayorinde
Olorunniyi Ayorinde

Reputation: 31

How to Exit (or Navigate out of )a MasterDetail page to a simple ContentPage in Xamarin. Forms?

I have a Xamarin.Forms app which has the following:

LoginPage - a ContentPage type
RegisterPage - a ContentPage type

parentMasterDetail - a MasterDetailPage type
masterPage - Master page (ContentPage type)
AppointmentPage - Detail page (ContentPage type)
NewAppointment - Detail  page (ContentPage type) 

I was able to create the pages all the pages as listed above, BUT

when I click on Logout button from the Detail page, the LoginPage displays but to my surprise it displayed just as a detail page, as if it is one of the detail pages and the menu page(i.e masterPage) is still accessible from my login page. This is not what I intended.

I want to logout of (i.e close) the MasterDetailPage, named parentMasterDetail, and navigate to the LoginPage which is not part of the MasterDetailPage such that the masterPage (i.e the menu) will not be accessible until user logs-in.

Please, anyone help me.

Upvotes: 3

Views: 2657

Answers (2)

Shailendra Kumar
Shailendra Kumar

Reputation: 168

If you need without top navigation bar (Header of Page), try this.

Application.Current.MainPage = (new UserLoginPage());

Upvotes: 1

Dakshal Raijada
Dakshal Raijada

Reputation: 1261

You can do something like this:

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

Upvotes: 7

Related Questions