Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 89864

[Tablet] MasterDetailPage inside MasterDetailPage

$
0
0

In my application, I'd like to have a MasterDetailPage (let's say MDChild) inside a MasterDetailPage (let's MDParent). My requirement is that the MDParent.Master is always hidden (and appears when the menu button is tapped) and the MDChild.Master is always visible.

I ended doing it this way

    var innerMasterDetailPage = new MasterDetailPage
                {
                    Master = new NavigationPage(new MyPage())
                    {
                        Title = "Navigation Title",
                    },
                    Detail = new NavigationPage(page)
                    {
                        BarTextColor = Color.White
                    },
                    Title = "Title 2",
                    MasterBehavior = MasterBehavior.Split
                };

                MasterDetailPage.Detail = innerMasterDetailPage;
                MasterDetailPage.Master = new MenuPage();
                MasterDetailPage.Title = "Title 1";
                MasterDetailPage.MasterBehavior = MasterBehavior.Popover;

This is the result in landscape

In portrait

Problem 1 (bug or regression?) : MDParent (with MasterBehavior.Popover) doesn't hide in landscape mode. In portrait, if I swipe right, the menu does appear and that's what I want but the button is missing. In landscape, it does nothing when I swipe and I want the menu to be hidden.

Problem 2 : As you can see, MDChild doesn't have the button to hide/show the MDParent master page.

Well, I thought I could something like

MasterDetailPage.Detail = new NavigationPage(innerMasterDetailPage);

This way, I have the following in landscape

In portrait

As you can see, the button to show/hide the menu is here but in landscape mode, it does nothing. And I don't want the whole big bar on the top (with the title "Title 2"). My toolbar buttons appear twice (once in the navigation of the page, once in the navigation of the masterdetail page).

What I want to achieve is the first screenshots with the button to show/hide the menu and the menu to be hidden in landscape mode.

Can anyone help me on this please?

Thanks a lot!


Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>