How to dismiss multiple (all) modals at once?

前端 未结 2 1235
情书的邮戳
情书的邮戳 2021-01-18 21:23

Is there a way to dismiss multiple modals or only one by one like this: Navigation.ModalPopAsync()?

相关标签:
2条回答
  • 2021-01-18 21:58

    For Modals you have to do one by one because its on the Modal Stack For Navigation Stack you can use Navigation.PopToRootAsync()

    Also you can try not awaitthe Navigation.ModalPopAsync() and also pass animation as false.

    You can find more details in this forum post- PopToRootAsync with Modal

    0 讨论(0)
  • 2021-01-18 22:10

    I've actually written something to pop all modals. Give it a shot.

    int numModals = Application.Current.MainPage.Navigation.ModalStack.Count;
    for (int currModal = 0; currModal < numModals; currModal++)
    {
        await Application.Current.MainPage.Navigation.PopModalAsync();
    }
    
    0 讨论(0)
提交回复
热议问题