this is what I have:
this is what I want to get:
If there is no pages in navigation stack, then title icon will be in left corner, else there will be back arrow and "Back" text. I didn't find any options to customize it, is it possible at all?
You can change arrow to hamburger icon if you use your MasterPage
within NavigationPage:
Detail = new NavigationPage(masterPage);
If you want to hide icon - it only applies to Android. It can be solved with custom renderer (http://developer.xamarin.com/guides/cross-platform/xamarin-forms/custom-renderer/):
[assembly:ExportRenderer (typeof(NavigationPage), typeof(CustomNavigationRenderer ))]
public class CustomNavigationRenderer : NavigationRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<NavigationPage> e)
{
base.OnElementChanged (e);
var actionBar = ((Activity)Context).ActionBar;
actionBar.SetIcon (Resource.Color.Transparent);
}
}
To change icon, just change project files:
- YourProject/Resources/drawable/icon.png
- YourProject/Resources/drawable-hdpi/icon.png
- YourProject/Resources/drawable-xhdpi/icon.png
- YourProject/Resources/drawable-xxhdpi/icon.png
or on your MasterDetailPage
set Icon
property to another resource.
use the static method SetTitleIcon on the NavigationPage object.
来源:https://stackoverflow.com/questions/30541603/how-to-change-xamarin-back-button-in-menu-bar