locked
Open master detail page menu by button? RRS feed

  • Question

  • User107118 posted

    Hi!

    In a master detail page you open its menu by swiping your finger to the left, but is it possible to open it with by pressing a button to? Like calling a "ShowMenuMethod" or something? :)

    Thanx

    Thursday, May 26, 2016 8:09 AM

Answers

  • User2148 posted

    Menu? You can show master or detail using

    https://developer.xamarin.com/api/property/Xamarin.Forms.MasterDetailPage.IsPresented/

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Thursday, May 26, 2016 9:12 AM

All replies

  • User2148 posted

    Menu? You can show master or detail using

    https://developer.xamarin.com/api/property/Xamarin.Forms.MasterDetailPage.IsPresented/

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Thursday, May 26, 2016 9:12 AM
  • User170482 posted

    inside the button click event.

    masterPage.IsPresented = true / false; // show / hide menu

    Thursday, May 26, 2016 10:18 AM
  • User107118 posted

    Just what I was looking for Thank you both so mutch!!! This really saved my day, and my job! haha ;)

    Thursday, May 26, 2016 11:59 AM
  • User201958 posted

    I'm having problems, share sample code pls... From another page button click IsPresented= true //// operation fails

    Friday, July 8, 2016 2:17 PM
  • User242391 posted

    Hallow can u suggest me how to open new Page on click event of Button

    Saturday, July 16, 2016 8:18 AM
  • User2148 posted

    Something like

            MasterDetailPage md = new MasterDetailPage ();
            md.Master = new Page1 ();
            md.Detail = new page2 ();
    
            Button b = new Button ();
            b.Text = "Another page";
            b.Clicked += async (object sender, System.EventArgs e) => {
    
                md.Detail = new Page3();
            };
    
    Saturday, July 16, 2016 8:40 AM
  • User2148 posted

    Obviously this code is not complete... it's only an example...

    Saturday, July 16, 2016 8:40 AM
  • User369473 posted

    @ilkerTaskin said:

    I'm having problems, share sample code pls... From another page button click IsPresented= true //// operation fails

    How did you fixed it bro ?

    Thursday, June 28, 2018 10:01 AM
  • User395974 posted

    As the MasterDetailPage has to be the root of the app, something like this should work: (App.Current.MainPage as MasterDetailPage).IsPresented = true;

    Friday, November 20, 2020 7:10 AM