Xamarin.Forms 主细节根页面
本文向大家介绍Xamarin.Forms 主细节根页面,包括了Xamarin.Forms 主细节根页面的使用技巧和注意事项,需要的朋友参考一下
示例
public class App : Application { internal static NavigationPage NavPage; public App () { // 您的应用程序的根页面 MainPage = new RootPage(); } } public class RootPage : MasterDetailPage { public RootPage() { var menuPage = new MenuPage(); menuPage.Menu.ItemSelected += (sender, e) => NavigateTo(e.SelectedItem as MenuItem); Master = menuPage; App.NavPage= new NavigationPage(new HomePage()); Detail = App.NavPage; } protected override async void OnAppearing() { base.OnAppearing(); } void NavigateTo(MenuItem menuItem) { Page displayPage = (Page)Activator.CreateInstance(menuItem.TargetType); Detail = new NavigationPage(displayPage); IsPresented = false; } }