I want to solve the problem, when I push the button several times - offers many of the same pages. I found here such code.
var stack = Navigation.NavigationStack;
if (stack[stack.Count - 1].GetType() != typeof(DetailsPage))
await Navigation.PushAsync (new DetailsPage ());
Navigation.NavigationStack - works fine.
Navigation.ModalStack - doesnt work. But I can
t get Name.
Please help me with this solution.
there are various threads on this common issue, I can see on the forums that you already commented on it, there are also NavigationExtensions
class:
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);
}
}
}
Here is the discussion:
https://forums.xamarin.com/discussion/29787/double-tapping-in-xamarin-forms-on-android