Rothariger
Rothariger

Reputation: 293

Navigation.PopAsync with a PushModalAsync?

i'm doing some support to an existing application. it's a really big application, and several pages are using a base controller, this controller works as the name says controller for all the events and stuff of the form.

the thing is that this application was done on xamarin 2.0 and never updated the version, now i've updated xamarin forms to the actual version 4.0 and some stuff works different. but the issue that bugs me more is Navigation.PopAsync. In the 2.0 it closes all "windows" it doesn't matter if it's modal or a normal window.

but now with xamarin 4.0, the modal windows are not closed.

is there a way of knowing if the current window in Navigation is a modal or something like that?

Regards.

Upvotes: 0

Views: 72

Answers (1)

Leo Zhu
Leo Zhu

Reputation: 14956

you could check whether it appears at the top of the Navigation.ModalStack like this:

 private bool IsModal(Page page)
    {
        if (page == Navigation.ModalStack[Navigation.ModalStack.Count])
        {
           // is modal page
            return true;
        }
        else
        {
           //not modal page
            return false;
        }
    }

Upvotes: 2

Related Questions