我想解决问题时,我想解决该问题。几次按下按钮 - 提供许多相同的页面。我在这里找到了这样的代码。
var stack = Navigation.NavigationStack;
if (stack[stack.Count - 1].GetType() != typeof(DetailsPage))
await Navigation.PushAsync (new DetailsPage ());
Navigation.NavigationStack
-工作正常。
Navigation.ModalStack
- don t work. But I can
t获取名称。
在这个常见问题上有各种线程,我可以在您已经对其进行评论的论坛上看到,也有NavigationExtensions
类:
public static class NavigationExtensions
{
public static async Task PushModalAsyncSingle(this INavigation nav, Page page, bool animated = false)
{
if (App.Navigation.ModalStack.Count == 0 ||
App.Navigation.ModalStack.Last().GetType() != page.GetType())
{
await nav.PushModalAsync(page, animated);
}
}
public static async Task PushAsyncSingle(this INavigation nav, Page page, bool animated = false)
{
if (App.Navigation.NavigationStack.Count == 0 ||
App.Navigation.NavigationStack.Last().GetType() != page.GetType())
{
await nav.PushAsync(page, animated);
}
}
}
这是讨论:https://forums.xamarin.com/discussion/29787/double-tapping-in-tapping-in-xamarin-forms-on-android