简体   繁体   中英

Xamarin Forms - Navigation.PopAsync() not working

I have a tab page i've set to the main page in xamarin forms:

 App.Current.MainPage = new MainPage();

MainPage is a tabbed page:

public partial class MainPage : TabbedPage
    {....

Within the tabbedPage there is a content page, which has a button click to load a MasterDetail View:

 await Navigation.PushAsync(new AttendMasterPage(new AttendanceViewModel(item)));

This works ok, but the masterdetail view is loaded within the tabbed page. so when i use Navigation.PopAsync(); on the Detail page once finished, nothing happens.

I need the page to go back to the original content page on the tabbed control using a button idealy.

Hope this makes sense, any more info needed please let me know

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.

Source: official doc

Please get familiar with the official documentation in order to prevent such problems.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM