Currently I'm using AppShell in my xamarin app. I need to hide back button arrow in NavBar and replace it with menu icon.
NavigationPage.HasBackButton="False"
Isn't working for me.
Asked
Active
Viewed 1,558 times
1

Octavia Togami
- 4,186
- 4
- 31
- 49

Wiktor Kęska
- 411
- 2
- 4
- 13
-
Can you try this in c# ? NavigationPage.SetHasBackButton(this, false); – Anand Jul 23 '20 at 14:14
-
Do you want to hide the navbar ? or just the back button? – Anas Alweish Jul 23 '20 at 14:14
-
@Anand In c# it doesn't work too. – Wiktor Kęska Jul 23 '20 at 14:27
-
1@AnasAlweish just back button and replace it with menu icon. – Wiktor Kęska Jul 23 '20 at 14:27
1 Answers
2
You could use the custom renderer to reset the NavigationIcon
. I use a star icon for reference.
[assembly: ExportRenderer(typeof(AppShell), typeof(ShellCustomRenderer))]
namespace ShellDemo.Droid
{
public class ShellCustomRenderer : ShellRenderer
{
public ShellCustomRenderer(Context context) : base(context)
{
}
protected override IShellToolbarAppearanceTracker CreateToolbarAppearanceTracker()
{
return new ToolbarAppearance();
}
}
public class ToolbarAppearance : IShellToolbarAppearanceTracker
{
public void Dispose()
{
}
public void ResetAppearance(Android.Support.V7.Widget.Toolbar toolbar, IShellToolbarTracker toolbarTracker)
{
//toolbar.SetBackgroundColor(Android.Graphics.Color.Red);
toolbar.SetNavigationIcon(Resource.Drawable.star_small);// Resource.Drawable.star_small;
}
public void SetAppearance(Android.Support.V7.Widget.Toolbar toolbar, IShellToolbarTracker toolbarTracker, ShellAppearance appearance)
{
//toolbar.SetBackgroundColor(Android.Graphics.Color.Red);
toolbar.SetNavigationIcon(Resource.Drawable.star_small);
}
}
}

Wendy Zang - MSFT
- 10,509
- 1
- 7
- 17