Forum Xamarin.Forms

Master Detail Page: Config Detail Page to Slide With Master Menu Rather than Menu Above

pmhart83pmhart83 USMember ✭✭✭
edited September 2016 in Xamarin.Forms

I noticed that MasterDetailPage has a "MasterBehavior" property which I currently have set to MasterBehavior.Popover.

Currently our menu slides on top of the detail page. We would like it to slide WITH the detail page and push the detail page x coordinate over as far as the menu is open. I have seen this before, and while setting the MasterBehavior to Split sort of achieves this the menu always stays open.

Does anyone know how to get a slide-able master menu that slides over the detail page not on top in iOS? I guess I could create my own custom UI for this but hoping there is something quick I could do.


  • pmhart83pmhart83 USMember ✭✭✭
    edited September 2016

    Here is what I have learned since posting yesterday:


    I can use a "PhoneMasterDetailRenderer" for the tablet MasterDetailPage but it goes 80% the width and looks bad.

    Looking at the source for this renderer here:

    The function:
    void LayoutChildren(bool animated)

    The 80% is hardcoded and the function is not virtual.


    If I extend TabletMasterDetailRenderer I can get the open animation to work if I override:

    With the following logic

    public override void ViewDidLayoutSubviews() { base.ViewDidLayoutSubviews(); if(View.Subviews.Length >= 2) { var x = 0; if((Element as MasterDetailPage).IsPresented) x = 320; var detailView = View.Subviews[1]; detailView.Frame = new CoreGraphics.CGRect(x,0,detailView.Frame.Width,detailView.Frame.Height); } }

    But ViewDidLayoutSubviews does not happen when the menu closes so the detail page stays at an offset x 320.


    Write my own ... I could basically just copy all the open source from just to change that 80% however after adding 6 extra classes it was getting to be too many dependencies and was still not all there. Would be easier just to write one custom scrollview.

Sign In or Register to comment.