The hamburger icon is not visible when the master part of MasterDetail view is closed in UWP project.
You can reproduce the bug with this sample:
https://github.com/xamarin/xamarin-forms-samples/tree/master/Navigation/MasterDetailPage
How can I make this icon reappear?
You can see this bug on the attached screenshot.
I think it's caused by the default behaviour on UWP (see info that helped me find a solution here https://bugzilla.xamarin.com/show_bug.cgi?id=40358)
I changed the code in the MainPage constructor to the following:
if (Device.OS == TargetPlatform.Windows) {
Master.Icon = "swap.png";
MasterBehavior = MasterBehavior.Popover; // Added this line of code
}
And now I see the hamburger icon.
Answers
I think it's caused by the default behaviour on UWP (see info that helped me find a solution here https://bugzilla.xamarin.com/show_bug.cgi?id=40358)
I changed the code in the MainPage constructor to the following:
if (Device.OS == TargetPlatform.Windows) {
Master.Icon = "swap.png";
MasterBehavior = MasterBehavior.Popover; // Added this line of code
}
And now I see the hamburger icon.
@DStenroejl I can confirmed this works! Thank you so much!
However, Device.OS is obsolete. Use:
if (Device.RuntimePlatform == Device.Windows) { Master.Icon = "swap.png"; MasterBehavior = MasterBehavior.Popover; }
I just put this code and it works... Thank you guys.
public MainPage()
{
InitializeComponent();