Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

Disable second tap on Image

$
0
0

Hi All,

I have an image where i am handling the click event using gestures. Example Below.

XAML CODE

    <Image Source="info.png" HeightRequest="20" WidthRequest="20">
            <Image.GestureRecognizers>
              <TapGestureRecognizer Tapped="OnTap" />
            </Image.GestureRecognizers>
    </Image>

CODE

    private void OnTap(object sender, EventArgs e)
            {
                    var resultTextView = new GenericListView("Result View");
                    Application.Current.MainPage.Navigation.PushAsync(resultTextView);
                }
            }

This works. But if user clicks on the image multiple times, then the tap event is called multiple times. I want it to be called only once.

How do i fix this?

Thank you.

Regards,
Manoj


Viewing all articles
Browse latest Browse all 91519

Trending Articles