Reputation: 599
I have a Xamarin'application with master detail page and I would like to have on ios, android and uwp the hamburger icon for the menu.
Now I'm using the sample found on xamarin site to create the master detail page.
On android the icon is visible without doing anything:
On ios (and UWP) isn't visible:
Why on ios and UWP there is this behavior? How can I have the icon on all three platform?
Thanks!
EDIT: I haven't include any image, nor for android nor for ios and UWP.
Upvotes: 1
Views: 1016
Reputation: 10831
I have tested the codes and found that it was caused by the outer NavigationPage
. You are currently nesting MasterDetailPage
inside NavigationPage
, which caused the disappearance of the toggle button.
So, the solution is easy, simply modify the following line of code in LoginPage.xaml.cs
:
await Navigation.PushAsync(new MasterDetailAppPage());
To this:
App.Current.MainPage = new MasterDetailAppPage();
Update:
In iOS, xamarin doesn't provide toggle button icon by default, you need to set it manually on the MasterPage. ie in MasterDetailAppPageMaster.xaml
:
<ContentPage
...
Icon="hamburger.png"
Title="{sgat:Translate appName}">
and add your icon image as resource into Resources folder of iOS project. but I've already seen hamburger.png
in your project. So you can use this directly.
Upvotes: 2