Hide the Master page of a MasterDetailPage in Landscape mode.

BadStormBadStorm ITMember ✭✭

Hi,
I created an app with a MasterDetailPage. My App work only in Landscape mode. On iPad when the App start, the Master Page is always visible.
I try to set IsPresented = false but nothing change.

It is possible to hide the Mater Page, and show it only if I press a button, for example?

Thanks

Posts

  • jp99jp99 MVMember ✭✭

    I'm facing the same problem... any help is appreciated!

    Thanks,
    jp99

  • JensBeckerJensBecker USUniversity

    We have the same problem, would be nice to know if it's possible or if we have to implement a custom control?

  • CraigDunnCraigDunn USXamarin Team Xamurai

    I think this was a design decision - the most well-known Master-Detail app on iPad is probably the iOS Mail app, and it keeps the master list permanently open in landscape view. There are many cases where we have had to make these choices to get a clean cross-platform API done for v1.

    See the post on reports & suggestions to add this to the list of things you'd like to see in future!

  • MarianGrzesikMarianGrzesik DEUniversity ✭✭

    You're right, the Master-Detail works so by iOS. But I think we should have the choice to change it. I need this behaviour too. It' be graet, if Xamarin could do an example, how to do it (may be with Rendering).

    In Xamarin.iOS there is an example, how to do it.

    http://developer.xamarin.com/recipes/ios/content_controls/split_view/use_split_view_to_show_two_controllers/

  • CraigDunnCraigDunn USXamarin Team Xamurai

    New features and enhancements can be requested on our UserVoice site.

  • MarianGrzesikMarianGrzesik DEUniversity ✭✭

    I created the new feature on UserVoice site. My problem is, that I must present a business app for a board of directors soon. The company has over 70 subsidiaries (over 1 billion business volume), which I wanted to show in the MasterPage. They want to see the whole page in a lanscape mode and the developers want to use the Xamari.Forms (not the Xamarin.iOS). I don't have so realy any choice, to make the app like expected. I create now the company filter as a ContentPage. It is not cool, but it works. To create such a filter as a dialog or better as a Popover (for iPad) is also not possible. I feel, that the Renderer should have more possiblity, to achive more complicated Scenario.

  • ThomasGrausgruberThomasGrausgruber ATMember
    edited August 2014

    So I was just sure that it is possible (since it is possible if you are not using Xamarin.Forms) didn't want to give it up and after a few hours I finally came up with the (one-lined) solution. Code is seen below:

    [assembly: ExportRenderer(typeof(CustomMasterDetailPage), typeof(PhoneMasterDetailRenderer), UIUserInterfaceIdiom.Phone)] [assembly: ExportRenderer(typeof(CustomMasterDetailPage), typeof(CustomTabletMasterDetailRenderer), UIUserInterfaceIdiom.Pad)] namespace YourProject.CustomRenderers { internal class CustomTabletMasterDetailRenderer : TabletMasterDetailRenderer { public CustomTabletMasterDetailRenderer () { ShouldHideViewController = (svc, controller, orientation) => true; } } }
    `

    Note, that there are two ExportRenderers needed because on iPhone we can still use the original one.

    In the Xamarin.Forms source one should change one single line to make this possible without using custom renderers but unfortunately it is still not implemented...

  • Thomas, in your example CustomMasterDetailPage is a Page correct?

    For some reason when I use the custom renderer it just gives a blank screen and the master is still visible in landscape so clearly I screwed something up.

  • MichaelRidlandMichaelRidland AUInsider, University ✭✭✭

    @ThomasGrausgruber‌

    Hi Thomas

    Did you find that the Icon disappeared when you implemented this?

  • Jack_SierkstraJack_Sierkstra USMember, University

    @ThomasGrausgruber‌ I have the same problem as @MichaelRidland‌ : When the app is started in landscape orientation, the menu shows up. When I dismiss it via the menu button, the icon disappears. When the app starts in portrait mode, the Master isn't toggable. I'd like the exact same behaviour on iOS that we have on Android.

  • @Xamarin Team: You should better implement these functionality as you did have bugs in for e.g. the navigation stuff. Sometimes it is required to close the master manually, because otherwise your "clean" framework is crashing.

    Please please please, prefer to work on bug fixes instead of coming up with ne features every 5min. It's so important that the framework runs stable. Bad framework => bad applications => bad reputations!

  • HodorHodor USMember

    Any updates for a fix on this one?

  • Hello,
    I am facing the issue too, I need to play some video into MasterDetail based application.
    Obviously I want full screen video in landscape and the MasterDetail paradigm is forcing me to use only "detail" client area, which is not the intended behavior.

    Has anybody got a workaround for this ?

  • PriyabrataDashPriyabrataDash USMember ✭✭

    I tried to find a solution for this. What I got is we can't do this using XForms.
    Reason:
    1-Since XForms targeting both Android & iOS whatever we are implementing should be in Sync in both the platforms.
    2-In Android we have a hardware back button, so by clicking it we can hide the MasterPage(Left Slide Out panel) whereas there is no hardware back button available in iOS & to hide the MasterPage we have to manually click & hide it.

    But yes it's always good to have an option to hide the MasterPage so that we can use it to disable MasterPage when requirement comes.
    For now I guess we have to live with it.

  • HodorHodor USMember

    @DavidRedmond That's awesome! Thanks a bunch! Gonna give it a shot

  • AneeAnee USMember

    I too facing the same issue on my application. I tried witth 'MasterBehavior = Xamarin.Forms.MasterBehavior.Popover;' but it doesn't seems to be working.

  • AleStrAleStr ITMember

    Tried it and it works.
    Thanks

  • JesseMJesseM USMember ✭✭

    @DavidRedmond, you saved my day! Awesome find. Works great!

    Just add that line in the constructor of your MasterDetailPage

  • RicibaldRicibald ITMember

    Change your Android style using transparent image, it works in all orientations:

    <?xml version="1.0" encoding="UTF-8" ?>
    <resources>
        <style name="MyTheme" parent="android:Theme.Holo.Light">
            <item name="android:homeAsUpIndicator">@drawable/MyTransparentPlaceholder</item>
        </style>
    </resources>
    
  • sam123sam123 INMember ✭✭

    @BadStorm said:
    Hi,
    I created an app with a MasterDetailPage. My App work only in Landscape mode. On iPad when the App start, the Master Page is always visible.
    I try to set IsPresented = false but nothing change.

    It is possible to hide the Mater Page, and show it only if I press a button, for example?

    Thanks

    dear just change MasterBehavior="Popover"

  • sam123sam123 INMember ✭✭

    @sam123 said:

    @BadStorm said:
    Hi,
    I created an app with a MasterDetailPage. My App work only in Landscape mode. On iPad when the App start, the Master Page is always visible.
    I try to set IsPresented = false but nothing change.

    It is possible to hide the Mater Page, and show it only if I press a button, for example?

    Thanks

    dear just change MasterBehavior="Popover"

    by default it is "SplitOnLandscape" so when app start it get landscape mode so it changes Master Behavior
    so solution is MasterBehavior="Popover"

  • KavyaSKavyaS USMember ✭✭
    edited April 2017


    how to disable master here?can we do this without using popover?

  • KrishTalaKrishTala INMember ✭✭

    @DavidRedmond said:
    @Hodor @PriyabrataDash @RomainTISSERAND

    I found a solution in this thread on the forum

    this.MasterBehavior = MasterBehavior.Popover;
    Thanks to @SapienDeveloper

    @DavidRedmond Thanks. great it works for me.

  • LucioMSPLucioMSP MXUniversity ✭✭✭

    @DavidRedmond I tried witth 'MasterBehavior = Xamarin.Forms.MasterBehavior.Popover;' but it doesn't seems to be working on any platform, too try with the others options like Split, this is my code:

    if (Device.RuntimePlatform == Device.Android)
    {
    this.MasterBehavior = MasterBehavior.Split;
    }
    menuPage = new MenuPage();

  • Mayur534Mayur534 Member ✭✭

    @DavidRedmond said:
    @Hodor @PriyabrataDash @RomainTISSERAND

    I found a solution in this thread on the forum

    this.MasterBehavior = MasterBehavior.Popover;
    Thanks to @SapienDeveloper

    This worked for me as well. Thanks

  • DareDevil69DareDevil69 USMember

    Ok, This worked ! Thanks @DavidRedmond !

Sign In or Register to comment.