Detecting single tap on chart with Xamarin SDK


#1

I can’t seem to get single tapping on a chart to work. I followed this older post (here but it’s still not working. My class implements IUIGestureRecognizerDelegate, and I have a method:

public bool ShouldRecognizeSimultaneously(UIGestureRecognizer gestureRecognizer, UIGestureRecognizer otherGestureRecognizer)

As the original post advises, I also do this on my chart:

foreach (var gesture in _chart.Canvas.Overlay.GestureRecognizers) if (gesture is UITapGestureRecognizer) gesture.Delegate = this;

But when I tap on my chart (it’s a donut type), the only thing that happens is that the donut pieces slide out and ShouldRecognizeSimultaneously doesn’t get called. Is there something else I’m missing? Or is that old post no longer valid? Thanks.


#2

Hi Architekt,

We have changed the way we implemented our gesture recognisers. We now assigned our own delegates to all our gesture recognisers meaning the solution explained in the forum post you linked is outdated.

The best way detect taps on your chart would be to either add another target to our current tap gesture recogniser or disable our tap gesture recogniser and add your own to your chart’s canvas.

Kind regards,
Andrew Polkinghorn.