Forum Xamarin.Forms

[Android] [v1.3] MasterBehavior.Split - How to remove arrow Icon?

ChaseFlorellChaseFlorell CAInsider, University mod
edited February 2015 in Xamarin.Forms

In our app's root MasterDetailpage we have a small piece in the constructor to tell it to behave as a SplitView on a Tablet.

        if (Device.Idiom == TargetIdiom.Tablet)
        {
            MasterBehavior = MasterBehavior.Split;
            Icon = "";      // Unfortunately this doesn't remove the icon.
        }

This is working great however the default arrow has returned on the navigation bar.

I have tried overriding the Icon in the NavigationPage, but that didn't seem to work.

public class StyledNavigationPage : NavigationPage
{
    public StyledNavigationPage(Page root) : base(root)
    {
        InitColors();
    }

    protected override void OnAppearing()
    {
        base.OnAppearing();
        InitColors();
        if (Device.Idiom == TargetIdiom.Tablet)
        {
            Icon = "";   
        }
    }

    private void InitColors()
    {
        BackgroundColor = (Color)Application.Current.Resources["BaseBlue"];
        BarBackgroundColor = (Color)Application.Current.Resources["BaseBlue"];
        BarTextColor = (Color)Application.Current.Resources["LightBlue"];
    }
}

What might I need to do to remove the arrow icon? As it stands, it does not behave as a back button anyways.

Posts

  • ChaseFlorellChaseFlorell CAInsider, University mod

    .

  • ElielDinaullyElielDinaully USMember

    Hi @ChaseFlorell ,

    got the same problem on Forms 1.4, did you manage to solve the issue?

    Thanks

  • AlisonFernandesAlisonFernandes USMember ✭✭
    edited May 2015

    Had the same problem in this thread, the solution is to set the Icon file name with extension* in the menu ContentPage.Icon and not in your MasterDetailPage.Icon. Afterwards, add the image as an asset in each platform:

    • /Resources folder in iOS
    • Project root in WindowsPhone
    • /Resources/drawable* folders in Android

    Note that, if you set the ContentPage.Icon with a folder path, this needs to be reflected in each platform accordingly. Check Hanselman.Forms if you run into any issues with the images place. Furthermore, I've that already fixed in the sample project I used to expose the problem in the other thread, check it here

    *Due to Windows Phone, iOS and Android work without the extension

  • rnitschrnitsch USMember

    I have the same problem and I have created a bug report for this issue (including a project to reproduce this issue):
    "MasterDetailPage showing back button instead of Icon in landscape mode (Tablet only)"
    https://bugzilla.xamarin.com/show_bug.cgi?id=39831

Sign In or Register to comment.