Bug 41038 - MasterDetailPage loses menu icon on iOS after reusing NavigationPage as Detail
Summary: MasterDetailPage loses menu icon on iOS after reusing NavigationPage as Detail
Status: RESOLVED ANSWERED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.0
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Rui Marinho
URL:
Depends on:
Blocks:
 
Reported: 2016-05-11 20:19 UTC by Brian Lagunas
Modified: 2018-02-12 18:32 UTC (History)
8 users (show)

Tags: ac
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description Brian Lagunas 2016-05-11 20:19:01 UTC
Using a MatserDetailPage; when using a NavigationPage as the Detail, and reusing it instead of creating a new instance, the icon is lost on iOS.  To reproduce the issue run this application:

    public class App : Application
    {
        public App()
        {
            MainPage = new MainMasterDetailPage();
        }
    }

    public class MainMasterDetailPage : MasterDetailPage
    {
        NavigationPage _navPage;

        public MainMasterDetailPage()
        {
            Title = "Main";

            var btnViewA = new Button() { Text = "ViewA" };
            btnViewA.Clicked += Button_Clicked;

            var btnViewB = new Button() { Text = "ViewB" };
            btnViewB.Clicked += Button_Clicked;

            var stack = new StackLayout();
            stack.Children.Add(btnViewA);
            stack.Children.Add(btnViewB);

            var master = new ContentPage() { Title = "Master", Content = stack };

            _navPage = new NavigationPage(new ViewA());

            Master = master;
            Detail = _navPage;
        }

        private async void Button_Clicked(object sender, EventArgs e)
        {
            Page root = _navPage.Navigation.NavigationStack[0];

            await _navPage.Navigation.PopToRootAsync(false);

            Page newRoot = null;

            var btn = (Button)sender;
            if (btn.Text == "ViewA")
                newRoot = new ViewA();
            else
                newRoot = new ViewB();

            await _navPage.Navigation.PushAsync(newRoot);

            _navPage.Navigation.RemovePage(root);
        }
    }

    public class ViewA : ContentPage
    {
        public ViewA()
        {
            Title = "ViewA";
            Content = new Label() { Text = "View A" };
        }
    }

    public class ViewB : ContentPage
    {
        public ViewB()
        {
            Title = "ViewB";
            Content = new Label() { Text = "View B" };
        }
    }
Comment 1 Rui Marinho 2016-06-16 16:26:44 UTC
Should be fixe in 2.3.1-pre1
Comment 2 Parmendra Kumar 2016-07-05 17:11:08 UTC
I have checked this issue with Xamarin.Forms 2.3.1-pre2 and its working fine.

Hence closing this issue.

Thanks.
Comment 3 Samantha Houts [MSFT] 2018-02-12 18:32:04 UTC
Migrated to https://github.com/xamarin/Xamarin.Forms/issues/1509.