gpt4 book ai didi

c# - 检查当前是否显示了 ContentPage

转载 作者:太空宇宙 更新时间:2023-11-03 18:54:34 25 4
gpt4 key购买 nike

有没有办法判断当前是否显示了 ContentPage?

我需要在 ContentPage 的事件处理程序中编写代码来检查页面当前是否显示并采取相应行动。

最佳答案

除了GBreen12的回答,你也可以这样做...

bool isShowingMyPage = Application.Current.MainPage is MyPage || (Application.Current.MainPage is NavigationPage navPage && navPage.CurrentPage is MyPage); //If you are using a MasterDetailPage or something else, then you would have to handle this differently

//I think the below will work for checking if any modals are showing over your page but you should definitely test it in different scenarios to make sure. I am not sure if the modal is immediately removed from ModalStack when it gets popped or not

isShowingMyPage = Application.Current.MainPage?.Navigation?.ModalStack?.LastOrDefault() == null;

关于c# - 检查当前是否显示了 ContentPage,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48629640/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com