Until the issue with `` on iOS is fixed I created a custom control to wrap a Shape
in a ContentView
and set the TapGestureRecognizer
on the ContentView
instead. The code has been attached.
TapGestureRecognizer Not working on iOS

Andrew
16
Reputation points
I'm working on an application where I've used TapGestureRecognizer
on a Path
. This works correctly in Android but when I build and debug on an iOS device (physical or emulated) the command bound to the recognizer doesn't work. The code is as follows:
<shapes:Path Data="{StaticResource CustomIconResource}">
<shapes:Path.GestureRecognizers>
<TapGestureRecognizer Command="{Binding ExecuteMyCommand}" />
</shapes:Path.GestureRecognizers>
</shapes:Path>
I don't see any exceptions in the log that would indicate why this isn't working. Any help on this would be great.
{count} votes
@Cole Xia (Shanghai Wicresoft Co,.Ltd.) I really appreciate you opening that case. jsuarezruiz linked to another issue that looks like the same issue. I tried setting the InputTransparent option in XAML as a workaround (which is mentioned in https://github.com/xamarin/Xamarin.Forms/issues/10623) but that didn't work for me unfortunately.
InputTransparent
does not work for me either.After some testing I decided to just create a custom control to wrap the Shape. The control is just a
ContentView
with aShape
as it's only child. I added aTapGestureRecognizer
to theContentView
, set theShape
sInputTransparent
attribute totrue
and exposed bindings for some of theShape
s attributes and for aCommand
that I bind to theTapGestureRecognizer
. Kind of a pain but it works and actually simplifies my XAML a little bit.It's seem the only workaround before the final fix release . If possible could you kindly post as answer below ?
Sign in to comment