Check if ContentPage is currently shown: Solution not working for me

50 views Asked by At

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.

1

There are 1 answers

0
FreakyAli On

If you are using Shell what you will have to do is get the current displayed Shell page.

var currentPage = Shell.Current.CurrentPage;