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

TapGestureRecognizer.Tapped never triggers

$
0
0

Hi there
What can be wrong with the following code:

public Action Click;
...
sl = new StackLayout();
...
img = new Image();
img.HeightRequest = 48;
img.WidthRequest = 48;
var tapGestureRecognizer = new TapGestureRecognizer();
tapGestureRecognizer.Tapped += (s, e) =>
{
if (Click != null) Click();
};
img.GestureRecognizers.Add(tapGestureRecognizer);
sl.Children.Add(img);

Image appears on the screen but if I tap on it, tapGestureRecognizer.Tapped never fires.

How to fix it?
Thanks.


Viewing all articles
Browse latest Browse all 75885

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>