My Sample custom control inherits from the SKCanvaView and overrides the OnTouch method. It simple prints into the Debug stream action type, however, the action type is always the type of Pressed.
From my understanding, I should get action types like Pressed, Released, Moved, Cancel.
Why I'm getting only the Pressed action type?
Version information:
Xamarin.Forms v5.0.0.2012
SkiaSharp.Views.Forms v2.80.2
Tested with Android device running in Hyper-V as well as a physical device, both with same results.
using SkiaSharp.Views.Forms;
namespace PurpleBlue.MobileApp.Controls
{
public class SampleControl : SKCanvasView
{
public SampleControl()
{
EnableTouchEvents = true;
}
protected override void OnTouch(SKTouchEventArgs e)
{
System.Diagnostics.Debug.WriteLine($"SampleControl: {e.ActionType}");
}
}
}
Output
[ViewRootImpl] ViewRoot's Touch Event : ACTION_DOWN
[0:] SampleControl: Pressed
[ViewRootImpl] ViewRoot's Touch Event : ACTION_UP
[ViewRootImpl] ViewRoot's Touch Event : ACTION_DOWN
[0:] SampleControl: Pressed
[ViewRootImpl] ViewRoot's Touch Event : ACTION_UP
[ViewRootImpl] ViewRoot's Touch Event : ACTION_DOWN
[0:] SampleControl: Pressed
[ViewRootImpl] ViewRoot's Touch Event : ACTION_UP
Control used in view
<controls:SampleControl
Grid.Row="1"
HorizontalOptions="Center"
HeightRequest="60"
WidthRequest="120"
BackgroundColor="Aqua"
/>