Beispiel #1
0
 protected async Task ClickHandler(MouseEventArgs e)
 {
     // https://stackoverflow.com/questions/5497073/how-to-differentiate-single-click-event-and-double-click-event
     // works good enough. Click is still called before the double click, but it is advise to not use both events anyway.
     if (e.Detail == 1)
     {
         await Clicked.InvokeAsync(EventArgsMapper.ToMouseEventArgs(e));
     }
     else if (e.Detail == 2)
     {
         await DoubleClicked.InvokeAsync(EventArgsMapper.ToMouseEventArgs(e));
     }
 }
Beispiel #2
0
 /// <summary>
 /// Handles the row clicked event.
 /// </summary>
 /// <param name="eventArgs">Supplies information about a mouse event that is being raised.</param>
 /// <returns>A task that represents the asynchronous operation.</returns>
 protected Task OnClickHandler(MouseEventArgs eventArgs)
 {
     // https://stackoverflow.com/questions/5497073/how-to-differentiate-single-click-event-and-double-click-event
     // works good enough. Click is still called before the double click, but it is advise to not use both events anyway.
     // We'll be treating any Detail higher then 2 as the user constantly clicking, therefore triggering Single Click.
     if (eventArgs.Detail == 1 || eventArgs.Detail > 2)
     {
         return(Clicked.InvokeAsync(EventArgsMapper.ToMouseEventArgs(eventArgs)));
     }
     else if (eventArgs.Detail == 2)
     {
         return(DoubleClicked.InvokeAsync(EventArgsMapper.ToMouseEventArgs(eventArgs)));
     }
     return(Task.CompletedTask);
 }