Bug 42175 - UWP MasterDetail has problems with the master always showing
Summary: UWP MasterDetail has problems with the master always showing
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows ()
Version: 2.3.2
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-06-26 12:03 UTC by Erik Renaud
Modified: 2017-08-10 21:27 UTC (History)
3 users (show)

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


Attachments
Repro project (256.94 KB, application/x-zip-compressed)
2016-06-26 12:03 UTC, Erik Renaud
Details
video of bug (1.04 MB, video/mp4)
2016-07-05 15:49 UTC, Erik Renaud
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 Erik Renaud 2016-06-26 12:03:08 UTC
Created attachment 16494 [details]
Repro project

I have an app where the MasterDetail where the behaves correctly on ios and android.  on uwp, the app opens and the masterdatail is always open, even if i click a selection it doesn't close.

I have created a small repro projet.
Comment 1 Rui Marinho 2016-07-04 17:12:08 UTC
UWP phone or desktop? If Desktop that's the normal behaviour. It will show in split mode, like for example it does on the iPad.
Comment 2 Erik Renaud 2016-07-04 20:47:09 UTC
on the desktop UWP...

when the app starte, the slidout is always visible, the currently selected item is not displayed as selected. It does not matter how i resize the window.

If i select the current "detail", it will show as selected, but the slidout stays open.

If i select another "detail", the slideout will disappear in the hamburger menu.
Comment 3 Erik Renaud 2016-07-05 02:11:55 UTC
Did a quick test and it's still acting weird...

            var p1 = new NavigationPage(new ContentPage()
            {
                BackgroundColor = Color.Green,
                Title = "detail title 1",
                Icon = "hamburger.png",
                Content = new StackLayout
                {
                    VerticalOptions = LayoutOptions.Center,
                    Children = {
                        new Label() { Text = "Page 1"}
                    }
                }
            });
            var p2 = new NavigationPage(new ContentPage()
            {
                BackgroundColor = Color.Green,
                Title = "detail title 2",
                Icon = "hamburger.png",
                Content = new StackLayout
                {
                    VerticalOptions = LayoutOptions.Center,
                    Children = {
                        new Label() { Text = "Page 2"}
                    }
                }
            });

            // The root page of your application
            MasterDetailPage x = null;
            x = new MasterDetailPage()
            {
                IsPresented = false,
                Detail = new NavigationPage(new ContentPage()
                {
                    BackgroundColor = Color.Green,
                    Title = "detail title",
                    Icon = "hamburger.png",
                    Content = new StackLayout
                    {
                        VerticalOptions = LayoutOptions.Center,
                        Children = {

                            new Label() { Text = "Initial Page"},
                        new Button {
                            HorizontalOptions = LayoutOptions.Center,
                            Text = "push new page!",
                            Command = new Command((t) => { ((MasterDetailPage)App.Current.MainPage).Detail.Navigation.PushAsync(new ContentPage() { BackgroundColor = Color.Lime }); })
                        }
                    }
                    }
                }),
                Master = new ContentPage()
                {
                    Icon = "hamburger.png",
                    BackgroundColor = Color.Pink,
                    Title = "master title",
                    Content = new StackLayout
                    {
                        VerticalOptions = LayoutOptions.Center,
                        Children = {
                        new Button {
                            HorizontalOptions = LayoutOptions.Center,
                            Text = "hamburger",
                            Command = new Command((t) => { })
                        },
                        new Button {
                            HorizontalOptions = LayoutOptions.Center,
                            Text = "page 1",
                            Command = new Command((t) => { x.Detail = p1; x.IsPresented = false; })
                        },
                        new Button {
                            HorizontalOptions = LayoutOptions.Center,
                            Text = "page 2",
                            Command = new Command((t) => { x.Detail = p2; x.IsPresented = false; })
                        },

                        }
                    }
                },
            };

            MainPage = x;
Comment 4 Rui Marinho 2016-07-05 10:55:46 UTC
On Desktop UWP the master is always open (split view) just lit in the iPad
Comment 5 Rui Marinho 2016-07-05 11:35:00 UTC
Can you provide a video? 

Thanks
Comment 6 Erik Renaud 2016-07-05 15:48:12 UTC
Here's a video of the xamarin forms app on UWP (desktop). It's the same code that is in the previous comment.

2 problems:
1 - when the app starts the slidout is open
2 - when the slideout is open, the hamburger button is not shown so we cannot close the slidout other then by calling code that sets "ispresented = false"
Comment 7 Erik Renaud 2016-07-05 15:49:02 UTC
Created attachment 16572 [details]
video of bug

video demo of bug
Comment 8 Rui Marinho 2016-08-04 14:45:32 UTC
Erik this is not a bug  this is the normal behaviour in Desktop mode, we show MDP as split with no way to close.
Comment 9 Erik Renaud 2016-08-04 15:14:22 UTC
But the thing is that if i select an option, then it does close...

i need it to be closeable, or at least close when the window hits a certain dimension.

Imagine making a calculator with a masterdetail that never closes... not very pretty...

Try my example and repo, you will see it doesn`t work...
Comment 10 Rui Marinho 2016-08-04 15:34:03 UTC
Ah ok, it should not allow you to close. I think i understand now.

Can you set MasterBehavior to be Popover to see if it works for you. 

Thanks.
Comment 11 Erik Renaud 2016-08-04 15:43:29 UTC
well, it`s either always open (in  which case i will adjust window size in consequence) or, what i would prefer, close and open...
Comment 12 Erik Renaud 2016-10-21 15:16:08 UTC
Any plan to fix this ? makes apps on UWP unusable...
Comment 13 Paul DiPietro [MSFT] 2017-08-10 21:27:27 UTC
I believe as Rui referred to in comment #10, the master page should not be allowed to close in Split mode. There was a PR[1] from a while back that changed this behavior so that it should only be able to be closed in Popover mode on the desktop. I'm going to mark this as resolved/fixed for now (and that fix should have been part of 2.3.5-pre1) since I believe this falls in line with the intended behavior per the aforementioned comment.

[1] https://github.com/xamarin/Xamarin.Forms/pull/707