Is there a way to detect clicks/taps on a image?
/Oliver
SkiaSharp has this which FFImageLoading is based on, you can see some examples of it here:
https://github.com/xamarin/xamarin-forms-samples/tree/master/SkiaSharpForms/SkiaSharpFormsDemos
If you're using SvgCachedImage, you can just add a GestureRecognizer as in any other Xamarin.Forms view: https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/gestures/tap/
This is working for me:
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="App.Views.MainPage"
xmlns:image="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms">
<ContentPage.Content>
<image:CachedImage Aspect="AspectFill" HeightRequest="200"
WidthRequest="200" Source="usericon200.png"
DownsampleToViewSize="true" HorizontalOptions="Center"
VerticalOptions="Start" x:Name="ProfileImage">
<image:CachedImage.GestureRecognizers>
<TapGestureRecognizer Tapped="ActivateDebugMode"
NumberOfTapsRequired="7" />
</image:CachedImage.GestureRecognizers>
</image:CachedImage>
<Image Source="settings50.png" VerticalOptions="Center"
TranslationX="80" TranslationY="-50"
HorizontalOptions="Center" WidthRequest="40">
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="OpenSettings" NumberOfTapsRequired="1" />
</Image.GestureRecognizers>
</Image>
</ContentPage.Content>
</ContentPage>
Is there any way to add custom gesture recognizer? Before applying FFImageLoading I had custom ImageRenderer. Is there any way to "subscribe" or override CachedImage OnTouch event?
Most helpful comment
This is working for me: