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?
Asked
Active
Viewed 790 times
1 Answers
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);
}
}
![](../../users/profiles/-1.webp)
Community
- 1
- 1
![](../../users/profiles/1155650.webp)
Rohit Vipin Mathews
- 10,853
- 15
- 49
- 100
-
this code will navigate new page inside details page. Thanks for your answer, but I looked for something different - navigation inside master page. It looks that this is impossible – Roman Kagan Mar 18 '15 at 13:02
-
Did you try Wrapping your Master page inside navigation page? – Rohit Vipin Mathews Mar 18 '15 at 13:19