Topic Author
Posts: 3
Joined: 20 Aug 2020, 21:04

DoubleTapped & IsDoubleTapEnabled - Are these bugs?

10 Jun 2021, 03:53

I've got a pair of issues with IsDoubleTapEnabled and the DoubleTapped event. I'm not sure whether these would be considered bugs or not, so I didn't want to submit them to the bug tracker quite yet.


In our application, we only use double-tap in two very small places. In the other 99% of the application, we want rapid tapping to be interpreted as many single taps. Therefore, we switch the default value of IsDoubleTapEnabled to false, and only set it to true in the two spots we actually use double-tap.
// At startup, before loading any GUI components:
UIElement.IsDoubleTapEnabledProperty.OverrideMetadata(typeof(FrameworkElement), new UIPropertyMetadata(false));

    Content="Test Button"
However, this doesn't work: IsDoubleTapEnabled needs to be set on whatever is directly under the mouse when the tap happens. For a plain text button, that means setting it on the Border and TextBlock inside the button.

The opposite is also true: If I don't change the default value, and set IsDoubleTapEnabled=False on a Button, its DoubleTapped event still gets raised. IsDoubleTapEnabled needs to be set to false on all the controls inside the Button to make DoubleTapped not get raised, and interpret it as two Tap events instead.

I think this might be a bug: I think it would make more sense if IsDoubleTapEnabled inherited from parent to child in the tree, so it can be set on a Button and not have to go through and set it on all the children manually.

(If this change is made, then we can switch it from overriding the default value of the property, to just setting it on the top-level Window, and letting it be inherited. Way easier.)


Second issue

If double-tap is enabled, then whenever I double-tap, then we get both the Tapped and DoubleTapped events raised. I think that when the first tap is received, it should wait the double-tap duration before raising the Tapped event, to be sure there isn't a second tap coming. It should only raise one or the other, not both.

I'm not sure precisely what WPF does in this case, but I know that some Windows components work this way, with a delay and only raising one or the other.
User avatar
Site Admin
Posts: 2207
Joined: 22 Dec 2011, 19:20

Re: DoubleTapped & IsDoubleTapEnabled - Are these bugs?

10 Jun 2021, 14:28

The first thing you comment about the IsDoubleTapEnabled property is something we internally discussed because we followed how UWP implemented that, but it was weird for us too.
I think, as you do, that having those "enabled" properties inherit down the tree will be a lot more useful. We will probably do that, could you report it in our bugtracker?

Regarding the sequence of events, we generate exactly the same as UWP does and we think it is correct (mouse events work the same way):
TouchDown ---> (nothing)
TouchUp -----> Tapped
TouchDown ---> DoubleTapped
TouchUp -----> (nothing)
Topic Author
Posts: 3
Joined: 20 Aug 2020, 21:04

Re: DoubleTapped & IsDoubleTapEnabled - Are these bugs?

10 Jun 2021, 19:03

could you report it in our bugtracker?
Done: #2045

I know that some components in Windows do wait the double-click interval before raising the "Click" event. Hell if I can remember where it is, though.

I guess I'll be implementing something to do that manually in our control: Tapped starts a timer, DoubleTap cancels the timer, timer performs the tap action.

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest