GestureRecognizers.Clear(); doesn't work for iOs

AIoanAIoan Member ✭✭

I am trying to add and then remove a tap gesture from a layout as I need an action to be only happening once. I Add a TapGestureRecognizer to my layout with a Command and a Tapped command. When I later on remove it using myLayout.GestureRecognizers.Clear(); the tap gesture keeps happening every time I tap inside myLayout even though the GesureRecognizers is empty. This works fine on Android.
I've created a sample project and attached the code snippet of xaml and xaml.cs below demonstrating the issue.
Not sure if this is a bug or I am just doing this wrong.

**<?xml version="1.0" encoding="utf-8" ?> <ContentPage x:Class="GestureRecognizerTest.MainPage" xmlns="" xmlns:x="" xmlns:local="clr-namespace:GestureRecognizerTest"> <StackLayout x:Name="TestLayout" HorizontalOptions="Center" VerticalOptions="Center"> <Label x:Name="TestLabel" Text="Click me to Add 'A1' ONCE:" /> </StackLayout> </ContentPage>

namespace GestureRecognizerTest
public partial class MainPage : ContentPage
public ICommand OnDoSomething { get; set; }

    public MainPage()
        OnDoSomething = new Command(() => TestLabel.Text += "A");

    public void AddGesture()
        TapGestureRecognizer testTapGesture;

        testTapGesture = new TapGestureRecognizer();

        testTapGesture.Tapped += ((o2, e2) =>
            TestLabel.Text += "1";

        testTapGesture.Command = OnDoSomething;


    public void RemoveGesture()



Sign In or Register to comment.