Bug 38105 - MasterDetailPage with NavigationPage nav bug
Summary: MasterDetailPage with NavigationPage nav bug
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.0.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-01-27 18:43 UTC by Brian Lagunas
Modified: 2016-02-17 19:23 UTC (History)
5 users (show)

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


Attachments
image showing the bug (24.01 KB, image/jpeg)
2016-01-27 18:43 UTC, Brian Lagunas
Details


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 FIXED

Description Brian Lagunas 2016-01-27 18:43:50 UTC
Created attachment 14758 [details]
image showing the bug

Using the latest stable release, I found an annoying bug.  When you are using a NavigationPage as the MasterDeatilPage.Detail, and then try to PopToRoot, PsuhAsync, and then remove the root of the NavigationPage, the toolbar button does not update correctly.

When you first navigate to a NavigationPage the result is the attached labeled "Step 1"

When you navigate to another page using the same NavigationPage, except you remove the root page the result is labeled "Step 2".

Given this simple repro:

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

    public class MyMasterDetail : MasterDetailPage
    {
        public MyMasterDetail()
        {
            Detail = new NavigationPage(new ViewA());

            var button = new Button() { Text = "Click me" };
            button.Clicked += (o, e) =>
            {
                var navPage = (NavigationPage)Detail;

                var rootPage = navPage.CurrentPage;

                navPage.PopToRootAsync(false);

                navPage.Navigation.PushAsync(new ViewB());

                navPage.Navigation.RemovePage(rootPage);

                IsPresented = false;
            };

            Master = new ContentPage()
            {
                Title = "test",
                Content = button
            };
        }
    }

    public class ViewA : ContentPage
    {
        public ViewA()
        {
            Title = "View A";
        }
    }

    public class ViewB : ContentPage
    {
        public ViewB()
        {
            Title = "View B";
        }
    }
Comment 1 Rui Marinho 2016-02-04 01:58:42 UTC
This should be fixed in the 2.1.0 hotfix to be released.