Windows 8 / XAML Double-Touch Event Always Precedes Tap

I have a button in the application. I want him to do different things depending on whether I click it (pause the animation) or double-click (restart the animation)

however, when I touch twice, it seems to fire the tap event first, and then double tap quickly. Is there any way around this? Is this a known issue, or am I making a rookie mistake?

Edit: for those who ask, I use the Tapped and DoubleTapped .

+8
c # windows-8 touch xaml double-click
source share
3 answers

You might want to consider letting him do both. Think about this, for example, by double-clicking the folder in the windows. Users will be used for something that happens the first time they are clicked (folder selection), and they expect a double click and select and then go.

In general, this looks like a design problem, not a technical one.

+4
source share

Pause one tab. If there is a double tab, then one tab event is excluded

  bool singleTap; private async void control_Tapped_1(object sender, TappedRoutedEventArgs e) { this.singleTap = true; await Task.Delay(200); if (this.singleTap) { // Single tab Method . } } private void control_DoubleTapped_1(object sender, DoubleTappedRoutedEventArgs e) { this.singleTap = false; // Double tab Method } 
+16
source share
 [System.Runtime.InteropServices.DllImport("user32.dll")] static extern uint GetDoubleClickTime(); bool _singleTapped = false; //Tapped event handler private async void control_Tapped(object sender, TappedRoutedEventArgs e) { _singleTapped = true; //var x = GetDoubleClickTime(); //GetDoubleClickTime() gets the maximum number of milliseconds that can elapse between a first click and a second click await Task.Delay(TimeSpan.FromMilliseconds(GetDoubleClickTime())); if (!_singleTapped) { return; } //SingleTapped code } //DoubleTapped event handler private async void control_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e) { _singleTapped = false; //DoubleTapped code } 
0
source share

All Articles