SkiaSharp touch event blocking Xamarin.Forms clicks

I have SkiaSharp overlayed overtop Xamarin.Forms with a full-screen AbsoluteLayout.

<ContentPage.Content>
    <AbsoluteLayout AbsoluteLayout.LayoutBounds="0,0,1,1" AbsoluteLayout.LayoutFlags="All" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
        <StackLayout AbsoluteLayout.LayoutBounds="0,0,1,1" AbsoluteLayout.LayoutFlags="All" Spacing="0">
            <Button Text="Click Me" Clicked="btnClicked" />
        </StackLayout>
        <skia:SKCanvasView x:Name="canvasView" 
                           PaintSurface="canvasView_PaintSurface" 
                           AbsoluteLayout.LayoutBounds="0,0,1,1" AbsoluteLayout.LayoutFlags="All"
                           Touch="canvasView_Touch" EnableTouchEvents="True" />
    </AbsoluteLayout>
</ContentPage.Content>

Here is my code-behind:

private void btnClicked(object sender, EventArgs e) {
    //Do something
}

private void canvasView_Touch(object sender, SKTouchEventArgs e) {
    if (e.ActionType == SKTouchAction.Released) {
        //Do something
    }
    e.Handled = true;
}

I have e.Handled = true because that gets me e.ActionType == SKTouchAction.Released and others, which I need, but it prevents the Xamarin.Forms button from being clicked, which I also need. If I comment that line out, Xamarin.Forms buttons work again, but all I get are SKTouchAction.Pressed. How can I get both the rich touch actions SkiaSharp offers while also passing the touch events through to Xamarin.Forms? Flipping the order in AbsoluteLayout (putting SkiaSharp behind Xamarin.Forms) doesn't help. Thanks!

Sign In or Register to comment.