I have an xamarin form application that has a login page. Upon successful login, the application will go to MainPageMenu, which is the main page. I have the same problem. This is my code in app.cs:
public App ()
{
InitializeComponent();
if (ApplicationSettings.NotLogin()) // Method to check if use if logged in or not
MainPage = new LoginPage();
else
MainPage = new NavigationPage(new MainPageMenus());
}
On the login page, I write this code:
//Some code for login .....
MasterDetailPage fpm = new MasterDetailPage
{
Master = new MainPageMenus(),
Detail = new NavigationPage(new MainPage())
};
Application.Current.MainPage = fpm;
The application will go to the fpm page correctly, but the problem is that when I click the menu icon, I get a page with detailed information not the main page.

This problem is similar to that described in this post . And the above code is selected as the answer to the question. But the code does not work for me. There is a similar question in stack overflow , and the answer was to use this:
Application.Current.MainPage = new NavigationPage(new MainPageMenus());
But in this case, the menu icon is hidden.
Here is the Xml MainPageMenus:
<?xml version="1.0" encoding="utf-8" ?>
<MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="XProject.Menus.MainPageMenus"
xmlns:local="clr-namespace:XProject"
Title="E-Clinic"
>
<MasterDetailPage.Master>
<ContentPage Title="Menu">
<StackLayout Orientation="Vertical">
<Button Clicked="GoToApplicationSettingsPage" Text="Application Settings"></Button>
<Button Clicked="GoToHxSettingsPage" Text="Medical History Settings"></Button>
<Button Clicked="GoToVisitsSettingsPage" Text="Visits Settings"></Button>
<Button Clicked="GoToCustomFieldsPage" Text="Custom Fields"></Button>
<Button Clicked="GoToAddCustomFieldsPage" Text="Add Custom Fields"></Button>
<Button Clicked="GoToAddCommonInfoPage" Text="Common Info"></Button>
<Button Clicked="GoToAddStatisticsPage" Text="Statistics"></Button>
<Button Clicked="GoToBackupPage" Text="Create Backup"></Button>
<Button Clicked="GoToRestoreBackupPage" Text="Restore Backup"></Button>
</StackLayout>
</ContentPage>
</MasterDetailPage.Master>
<MasterDetailPage.Detail>
<local:MainPage></local:MainPage>
</MasterDetailPage.Detail>
</MasterDetailPage>