0
votes

When trying to navigate from a Content Page to a MasterDetail Page the menu icon does not appear. Although, if i first load my MasterDetail Page the menu icon is there as tis supposed to be. The menu functionality is not affected. Working on Xamarin Forms but the problem occurs only when debugging in Android device. Any idea about the icon?

Load instantly MasterDetail Page using MainPage = new NavigationPage(new MainPage()) Load from Content Page (LoginPage) using MainPage = new NavigationPage(new Login()) then when a button is pressed navigate to MasterDetail Page using await Navigation.PushAsync(new MainPage(), true); Menus works on both cases

1

1 Answers

1
votes

Changing from a content page to a master detail page is achieved by changing your navigation stack. You need to replace the MainPage to do this.

It's two different types of navigation.

You usually see this type of stack swap when navigating from a login page which is usually a simple content page to the main app landing page which can be a master detail page.

So rather than this

await Navigation.PushAsync(new MainPage(), true);

Do this

Application.MainPage = new MainPage();

If you are using an MVVM framework, this can best be achieved with a StackService injected into the View Model.

The MVVM framework I use, FreshMVVM, has the ability to swap out navigation stacks built in.

Follow this link then jump to the "Switching out NavigationStacks on the Xamarin.Forms MainPage" section for more details.