SkiaSharp SKCanvasView Touch events strange behaviour with Shell

Hi Xamarin.Forms devs!

I have a ContentPage with a StackLayout including a single (full screen) SKCanvasView with touch events enabled and the relative registered event handler decoding SKTouchAction (pressed, moved, released and cancelled). Assigning this ContentPage to the MainPage property of the App and running on physical devices (Samsung GT-N8010/Android 4.4 and Samsung SM-G900F/Android 6.0) the events are generated as expected:

  • finger on screen = pressed
  • finger moving while still in contact = moved
  • finger off screen = released

The same ContentPage presented as a ShellContent inside a Tab inside a FlyoutItem of a Shell sub-class (with NavBarIsVisible set to false to keep the canvas full screen) assigned to the MainPage property of the App behaves differently:

  • finger touch and remove without actually moving: generated events are pressed, moved, moved, moved... ,moved and released
  • finger touch, moving around then remove: generated events are: pressed, moved, moved, moved... (while finger in the same position) and cancelled (when finger starts moving).

Any idea about?
Thanks for reading.


  • dprudpru Member ✭✭
    edited July 19

    I am actually receiving this same exact behavior. Currently I am developing using Visual Studio for Mac, and I am just testing on the Android emulator.

    When I click in the view, I get a "pressed" event. When I begin to move, I get a "moved" event. But if I move too far...and that's not very far at all... it suddenly gives me a "cancelled" event. And my touch is definitely still within the bounds of the SkiaSharp view.

    I would be interested to know if you (or anyone else) knows why it is behaving like this!

  • dprudpru Member ✭✭

    I figured out the issue (kind of) in my situation: I had an SKCanvasView sitting inside of a ScrollView. For some reason, if I move too much, I think the ScrollView basically takes over so it cancels the touch operation on the SKCanvasView.

    If, however, I put the SKCanvasView in a Grid instead, then I don't get "cancelled" events after moving too much.

    Maybe your situation is similar?

  • lgammalgamma Member

    Thank for your contribute. I have a full graphic App loading a ContentPage with only an SKCanvasView using StackLayout. Also tried using Grid but the behavior is the same. That ContentPage instantiated by App works as expected while the same ContentPage loaded as ShellContent fails in the handling of touch events. It seem to interfere with the OS' gesture recognition which causes SkiaSharp event cancellation.

Sign In or Register to comment.