9

After I updated my Xamarin.Forms project from Xamarin.Forms 2.0 to Xamarin.Forms 2.2, the Hamburger Icon is gone.

I've googled without luck, has anybody experienced the same issue?

Jannie Theunissen
  • 28,256
  • 21
  • 100
  • 127
The Chris
  • 591
  • 6
  • 19

3 Answers3

7

If the default icon has disappeared you can set your own icon of the Master page for example:

public class MasterPage : MasterDetailPage
{
    FlyOutMenuPage menu = new FlyOutMenuPage ();
    Master = menu;
}

public class FlyOutMenuPage : ContentPage
{
    Icon = "menu.png";
} 

And menu.png is a resource image, you can get lots of icon from here:

https://www.iconfinder.com/search/?q=hamburger&price=free

Mario Galván
  • 3,964
  • 6
  • 29
  • 39
  • Thanks for the tip. I have some pictures in the app, that already work on buttons. I set one of these as the icon of the masterdetailpage, but the MasterButton (Hamburger) is still not available. ;( May this a bug, that only appears in Win10 UWP apps? – The Chris May 13 '16 at 11:19
  • I would like to add that there's lot talk against tge hamburger menu as an design pattern that lowers user engagement. So consider othe navigation patterns as well (such as toolbar, tabs or menu links) – Thomas Hagström May 14 '16 at 09:30
  • It is recommended to use a 32x32 icon. You can find one here: https://www.freeicons.io/office-and-workstation-icons-5/menu-icon-18931# – David Jesus Sep 15 '20 at 14:45
0

Mine was hidden in Android, so I had to write a custom renderer to apply a color and set the opacity to show it again:

[assembly: ExportRenderer(typeof(CustomNavigationPage), typeof(CustomNavigationRenderer))]

namespace App.Droid
{
    public class CustomNavigationRenderer : NavigationPageRenderer
    {

        public CustomNavigationRenderer(Context context) : base(context)
        {
        }

        protected override void OnLayout(bool changed, int l, int t, int r, int b)
        {
            base.OnLayout(changed, l, t, r, b);
            var toolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            for (var i = 0; i < toolbar.ChildCount; i++)
            {
                var imageButton = toolbar.GetChildAt(i) as ImageButton;

                var hamburger = imageButton?.Drawable as DrawerArrowDrawable;
                if (hamburger == null)
                    continue;

                hamburger.Color = Context.GetColor(Resource.Color.primary_text_default_material_light);
                hamburger.Alpha = 255;
            }


        }
    }
}
Jannie Theunissen
  • 28,256
  • 21
  • 100
  • 127
0

Please know that the hamburger menu is not shown on IOS builds.