0

I have a master detail page, and I want to define menu to be a navigation page, so when I select some item in menu, it will open another menu with animation. I tried to create a master as navigation page, and push async new page when selecting an item - but it doesn't work for some reason. Is it possible at all, or there is other way?

Roman Kagan
  • 454
  • 1
  • 3
  • 11

1 Answers1

0

You can have a look at this : https://www.syntaxismyui.com/xamarin-forms-masterdetail-page-navigation-recipe/

This is also a good one to look into Xamarin.Forms - Master/detail page and navigation history issue

You have to wrap your detail page inside a navigation page so that you get the navigation properties. Is that the bit you are missing?

public class RootPage : MasterDetailPage
{
    public RootPage ()
    {
        var menuPage = new MenuPage ();
        menuPage.Menu.ItemSelected += (sender, e) => NavigateTo (e.SelectedItem as MenuItem);
        Master = menuPage;
        Detail = new NavigationPage (new ContractsPage ());
    }

    void NavigateTo (MenuItem menu)
    {
        Page displayPage = (Page)Activator.CreateInstance (menu.TargetType);
        Detail = new NavigationPage (displayPage);
    }
}
Community
  • 1
  • 1
Rohit Vipin Mathews
  • 10,853
  • 15
  • 49
  • 100