I need a control that can respond to both single click / tap and double click / tap. I found out I cannot use TapGestureRecognizer if I want to handle both single and double clicks / taps. So, I am trying to extend a Label control, adding a Click event handler. I tried the following code, but the event does not fire. Any suggestions? Thanks!
in LabelClickable.cs:
...
public class LabelClickable : Label
{
public event EventHandler Clicked;
public virtual void OnClicked()
{
Clicked?.Invoke(this, EventArgs.Empty);
}
}
...
in MainPage.XAML:
...
<local:LabelClickable Text="0" Clicked="Button_Clicked"/>
...
and in MainPage.Xaml.cs:
...
private void Button_Clicked(object sender, EventArgs e)
{
//do something;
}
...