Xamarin 表格 - Navigation.PopAsync() 不工作
Xamarin Forms - Navigation.PopAsync() not working
我有一个标签页,我已将其设置为 xamarin 表单中的主页:
App.Current.MainPage = new MainPage();
MainPage 是一个标签页:
public partial class MainPage : TabbedPage
{....
在 tabbedPage 中有一个内容页面,它有一个按钮点击加载 MasterDetail 视图:
await Navigation.PushAsync(new AttendMasterPage(new AttendanceViewModel(item)));
这工作正常,但 masterdetail 视图加载到选项卡式页面中。所以当我使用 Navigation.PopAsync();在详细信息页面上完成后,什么也没有发生。
我需要使用按钮让页面返回到选项卡式控件上的原始内容页面。
希望这是有道理的,如果需要更多信息,请告诉我
A MasterDetailPage is designed to be a root page, and using it as a
child page in other page types could result in unexpected and
inconsistent behavior. In addition, it's recommended that the master
page of a MasterDetailPage should always be a ContentPage instance,
and that the detail page should only be populated with TabbedPage,
NavigationPage, and ContentPage instances. This will help to ensure a
consistent user experience across all platforms.
来源:official doc
请熟悉官方文档以防止出现此类问题。
我有一个标签页,我已将其设置为 xamarin 表单中的主页:
App.Current.MainPage = new MainPage();
MainPage 是一个标签页:
public partial class MainPage : TabbedPage
{....
在 tabbedPage 中有一个内容页面,它有一个按钮点击加载 MasterDetail 视图:
await Navigation.PushAsync(new AttendMasterPage(new AttendanceViewModel(item)));
这工作正常,但 masterdetail 视图加载到选项卡式页面中。所以当我使用 Navigation.PopAsync();在详细信息页面上完成后,什么也没有发生。
我需要使用按钮让页面返回到选项卡式控件上的原始内容页面。
希望这是有道理的,如果需要更多信息,请告诉我
A MasterDetailPage is designed to be a root page, and using it as a child page in other page types could result in unexpected and inconsistent behavior. In addition, it's recommended that the master page of a MasterDetailPage should always be a ContentPage instance, and that the detail page should only be populated with TabbedPage, NavigationPage, and ContentPage instances. This will help to ensure a consistent user experience across all platforms.
来源:official doc
请熟悉官方文档以防止出现此类问题。