I used the same title as this thread because the solutions offered there are not really useful for me:
1.) Because I used the templates generated by Visual Studio, MainPage = new AppShell();
, Application.Current.MainPage
is always AppShell
.
2.) This page is defined as FlyoutItem but is also called over GoToAsync
. So OnAppearing
is called when the FlyoutItem
has been initalized (but hidden by another page defined in CurrentItem
), but will not be called when this page appears after selecting by the FlyoutMenu.
If you are using Shell what you will have to do is get the current displayed Shell page.