We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Single and Double taps

I have a grid that needs both single tap and double tap interaction.  Either of them works fine by itself, but if I try to add both of them, single tap always steals the interaction and double tap never gets called.

grid.GridTapped += Grid_GridTapped;
grid.GridDoubleTapped += Grid_GridDoubleTapped;
  //never gets called

5 Replies

SS Sivaraman Sivagurunathan Syncfusion Team April 12, 2017 05:40 PM UTC

Hi Clint Anderson,

Thanks for contacting Syncfusion Support.

We have analyzed your query, and we are unable to reproduce the issue at our end. We were able to fire the GridDoubleTapped event inspite of hooking the GridTapped event. It is the default behavior that single tap gets invoked when performing a double tap. But double tap gets called after single tap is called. Hence please share your code snippets or sample replicating the issue with clear replication procedure.

Regards,
Sivaraman

 



SS Sivaraman Sivagurunathan Syncfusion Team April 12, 2017 05:40 PM UTC

Hi Clint Anderson,

Thanks for contacting Syncfusion Support.

We have analyzed your query, and we are unable to reproduce the issue at our end. We were able to fire the GridDoubleTapped event inspite of hooking the GridTapped event. It is the default behavior that single tap gets invoked when performing a double tap. But double tap gets called after single tap is called. Hence please share your code snippets or sample replicating the issue with clear replication procedure.

Regards,
Sivaraman

 



SS Sivaraman Sivagurunathan Syncfusion Team April 12, 2017 05:40 PM UTC

Hi Clint Anderson,

Thanks for contacting Syncfusion Support.

We have analyzed your query, and we are unable to reproduce the issue at our end. We were able to fire the GridDoubleTapped event inspite of hooking the GridTapped event. It is the default behavior that single tap gets invoked when performing a double tap. But double tap gets called after single tap is called. Hence please share your code snippets or sample replicating the issue with clear replication procedure.

Regards,
Sivaraman

 



CA Clint Anderson April 12, 2017 05:45 PM UTC

It appears that due to some transformations in the single tap, and some null checks in the double tap I mistakenly thought that my double tap was not getting called.

Is there a way to detect a double tap from within the single tap method so that I know not to execute that code if it was a double tap?


DS Divakar Subramaniam Syncfusion Team April 13, 2017 09:01 AM UTC

Hi Clint Anderson, 
 
 
Yes. You can check/detect the double tap in single tap event as you required. Please refer the below code snippet. 
 
 
//Variable to check whether the double tab event is triggered or not. 
private bool isDoubleTapped; 
 
private void DataGrid_GridDoubleTapped(object sender, GridDoubleTappedEventsArgs e) 
{ 
    isDoubleTapped = true; 
} 
 
private async void DataGrid_GridTapped(object sender, GridTappedEventsArgs e) 
{ 
    //do your code here if any.. 
    await Task.Delay(2000); 
 
    if (isDoubleTapped) 
    { 
        //if double tap is listened, this block will hit. you can do your codes here. 
    } 
    isDoubleTapped = false; 
} 
  
 
In the above code, we have delayed the further process in GridTapped event once you tap the grid. So, the GridDoubleTapped event will be fired even before the completion of GridTapped event. Hence, you can detect the GridDoubleTapped event in GridTaped event itself. 
 
 
We have prepared a simple sample for your reference and you can download the same from the below link. 
 
 
 
Regards, 
Divakar.  


Loader.
Live Chat Icon For mobile
Up arrow icon