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

TapGestureRecognizer not getting called

$
0
0

Hi folks!

I've got a simple class that extends a Button. I use this button on a form, I get a breakpoint in the constructor, so the tapGestureRecognizer gets created, but I never get a breakpoint in my DrawFunky call (I deploy to my device and press the button of course - that doesn't work). Is it possible to add myself as a listener right in my constructor?

public class CustomButton : Button
{
    public CustomButton()
    {
        TapGestureRecognizer tapGestureRecognizer = new TapGestureRecognizer
        {
            Command = new Command(DrawFunky),
        };
        GestureRecognizers.Add(tapGestureRecognizer);   
    }

    private async void DrawFunky()
    {
        uint length = 150;
        await Task.WhenAll(this.ScaleTo(3, length), this.RotateTo(180, length));
        await Task.WhenAll(this.ScaleTo(1, length), this.RotateTo(360, length));
        this.Rotation = 0;
    }

}

Viewing all articles
Browse latest Browse all 77050

Trending Articles