How to dismiss multiple (all) modals at once?

前端 未结 2 1261
情书的邮戳
情书的邮戳 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 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();
    }
    

提交回复
热议问题