Skip to content

Conversation

@MartyIX
Copy link
Contributor

@MartyIX MartyIX commented Feb 27, 2024

Description of Change

Currently, on main when one defines

<Label Text="SingleAndDoubleTap" FontSize="32" TextColor="Blue">
    <Label.GestureRecognizers>
        <TapGestureRecognizer Tapped="OnTap"/>
        <TapGestureRecognizer Tapped="OnDoubleTap" NumberOfTapsRequired="2"/>
    </Label.GestureRecognizers>
</Label>

and double clicks that label, it leads to the following calls:

  1. OnTap
  2. OnTap
  3. OnDoubleTap

This PR makes it so that a double click leads to:

  1. OnTap
  2. OnDoubleTap

This new behavior seems to be more in line with https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.uielement.doubletapped?view=winrt-19041 which mentions:

If a user interaction also fires DoubleTapped, Tapped will fire first to represent the first tap, but the second tap won't fire an additional Tapped. If you want different logic for Tapped versus DoubleTapped, your Tapped handler may need to use app-specific variables and a timer in order to avoid running on interactions that are eventually interpreted as a DoubleTap action.

Demo

Main:

main-doubleClick

PR:

pr-doubleClick

Issues Fixed

Fixes #16235

@MartyIX MartyIX requested a review from a team as a code owner February 27, 2024 19:04
@ghost ghost added the community ✨ Community Contribution label Feb 27, 2024
@ghost
Copy link

ghost commented Feb 27, 2024

Hey there @MartyIX! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@MartyIX
Copy link
Contributor Author

MartyIX commented Feb 27, 2024

@PureWeen Would this PR make sense to you please1?

Footnotes

  1. Given that you worked on Secondary ButtonMask #9589.

@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@MartyIX MartyIX force-pushed the feature/2024-02-27-Windows-doubleTap-PR branch from 7e54970 to 56835d4 Compare May 20, 2024 12:03
@mattleibow
Copy link
Member

mattleibow commented May 20, 2024

@MartyIX thanks for this PR. Are you able to move the sample code into some UI tests so we can run the checks on CI. Thanks!

We have some docs here: https://github.com/dotnet/maui/blob/main/docs/design/UITesting.md

@jsuarezruiz / @PureWeen do we have new/better/updated docs for writing tests?

@mattleibow
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Copy link
Member

@mattleibow mattleibow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking for now as this PR needs tests and the sandbox sample needs to be reverted.

@MartyIX
Copy link
Contributor Author

MartyIX commented May 20, 2024

@MartyIX thanks for this PR. Are you able to move the sample code into some UI tests so we can run the checks on CI. Thanks!

We have some docs here: https://github.com/dotnet/maui/blob/main/docs/design/UITesting.md

@jsuarezruiz / @PureWeen do we have new/better/updated docs for writing tests?

So I created the PR with the hope that I'll get a "concept ACK". Is it a concept ACK then? I mean is the new behavior correct according to you?

@MartyIX
Copy link
Contributor Author

MartyIX commented May 20, 2024

@MartyIX thanks for this PR. Are you able to move the sample code into some UI tests so we can run the checks on CI. Thanks!

I can try. Yes.

@mattleibow
Copy link
Member

mattleibow commented May 21, 2024

Is it a concept ACK then? I mean is the new behavior correct according to you?

I think so.

How do all the other platforms handle this?

How do the pointer gestures work with this? Do the windows docs still apply

A DoubleTapped event represents a gesture, whereas a PointerPressed event is a lower-level input event. DoubleTapped and PointerPressed events can fire as the result of a single user interaction. Even if a control is already handling pointer events in the control logic, or is handling manipulations, that doesn't prevent DoubleTapped from firing.

I feel like this and the surrounding remarks are saying that because tap and double tap are "gestures", they work in the logical sense of tap then double tap, but if you really want the actual actions, the pointer events (maui pointer gestures) are what you can use.

@PureWeen @jsuarezruiz ?

@MartyIX MartyIX force-pushed the feature/2024-02-27-Windows-doubleTap-PR branch from 56835d4 to 5f4e61c Compare May 28, 2024 13:48
@MartyIX
Copy link
Contributor Author

MartyIX commented May 28, 2024

Blocking for now as this PR needs tests and the sandbox sample needs to be reverted.

Added 56bb877 and 5f4e61c.

How do all the other platforms handle this?

How do the pointer gestures work with this? Do the windows docs still apply

A DoubleTapped event represents a gesture, whereas a PointerPressed event is a lower-level input event. DoubleTapped and PointerPressed events can fire as the result of a single user interaction. Even if a control is already handling pointer events in the control logic, or is handling manipulations, that doesn't prevent DoubleTapped from firing.

I feel like this and the surrounding remarks are saying that because tap and double tap are "gestures", they work in the logical sense of tap then double tap, but if you really want the actual actions, the pointer events (maui pointer gestures) are what you can use.

I'm not really sure. I noticed that there is a new comment here. Apart from that I guess this needs more research or somebody who knows the stuff already.

@Foda
Copy link
Member

Foda commented Jun 6, 2024

Is it a concept ACK then? I mean is the new behavior correct according to you?

I think so.

How do all the other platforms handle this?

How do the pointer gestures work with this? Do the windows docs still apply

A DoubleTapped event represents a gesture, whereas a PointerPressed event is a lower-level input event. DoubleTapped and PointerPressed events can fire as the result of a single user interaction. Even if a control is already handling pointer events in the control logic, or is handling manipulations, that doesn't prevent DoubleTapped from firing.

I feel like this and the surrounding remarks are saying that because tap and double tap are "gestures", they work in the logical sense of tap then double tap, but if you really want the actual actions, the pointer events (maui pointer gestures) are what you can use.

@PureWeen @jsuarezruiz ?

From the linked comment below:

iOS in MAUI 8.0.40: first tap triggers the tapped event and then the second tap triggers the double > tapped event. #16235 (comment)

Android never fires the single tap event and only fires the double tapped event.

Since iOS does it the same way winUI does, I would be inclined to make the behavior "tap, double tap".

@PureWeen PureWeen force-pushed the feature/2024-02-27-Windows-doubleTap-PR branch from 5f4e61c to 414175b Compare August 20, 2025 22:11
@PureWeen PureWeen force-pushed the feature/2024-02-27-Windows-doubleTap-PR branch from 414175b to ebd7e23 Compare August 21, 2025 11:43
@PureWeen PureWeen moved this from Todo to Ready To Review in MAUI SDK Ongoing Aug 21, 2025
@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen
Copy link
Member

@morning4coffe-dev tested this on WinUI and it seems like the WinUI docs aren't accurate.
That being said, it'd be good to fix this so all 3 platforms are the same, since they are now all different

This is a good first step.

image

@morning4coffe-dev morning4coffe-dev force-pushed the feature/2024-02-27-Windows-doubleTap-PR branch 3 times, most recently from b138f16 to ebd7e23 Compare August 21, 2025 16:34
@morning4coffe-dev
Copy link
Contributor

morning4coffe-dev commented Aug 21, 2025

Adjusted the behavior on Android to match Windows more closely:

android-pointer.mp4

CC @PureWeen let me know what you think about the changes

@morning4coffe-dev morning4coffe-dev changed the title [Win] Double tap behavior Align OnDoubleTap behavior on Windows and Android Aug 22, 2025
@PureWeen
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

1 similar comment
@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@MartyIX
Copy link
Contributor Author

MartyIX commented Aug 22, 2025

@morning4coffe-dev Thank you for moving this forward :)

@PureWeen
Copy link
Member

Adjusted the behavior on Android to match Windows more closely:

android-pointer.mp4
CC @PureWeen let me know what you think about the changes

C:\a_work\1\s\src\Controls\tests\TestCases.HostApp\FeatureMatrix\CheckBox\CheckBoxControlPage.xaml(22,27): XamlC error XC0009: No property, BindableProperty, or event found for "Command", or mismatching type between value and property. [C:\a_work\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-maccatalyst]
C:\a_work\1\s\src\Controls\tests\TestCases.HostApp\FeatureMatrix\CheckBox\CheckBoxControlPage.xaml(22,27): XamlC error XC0009: No property, BindableProperty, or event found for "Command", or mismatching type between value and property. [C:\a_work\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-ios]
C:\a_work\1\s\src\Controls\tests\TestCases.HostApp\FeatureMatrix\CheckBox\CheckBoxControlPage.xaml(22,27): XamlC error XC0009: No property, BindableProperty, or event found for "Command", or mismatching type between value and property. [C:\a_work\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
C:\a_work\1\s\src\Controls\tests\TestCases.HostApp\FeatureMatrix\CheckBox\CheckBoxControlPage.xaml(22,27): XamlC error XC0009: No property, BindableProperty, or event found for "Command", or mismatching type between value and property. [C:\a_work\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-windows10.0.20348.0]
C:\a_work\1\s\src\Controls\tests\TestCases.HostApp\FeatureMatrix\CheckBox\CheckBoxControlPage.xaml(22,27): XamlC error XC0009: No property, BindableProperty, or event found for "Command", or mismatching type between value and property. [C:\a_work\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-windows10.0.19041.0]
12 Warning(s)
5 Error(s)

@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@morning4coffe-dev
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen PureWeen merged commit 117c36e into dotnet:net10.0 Sep 15, 2025
148 checks passed
@github-project-automation github-project-automation bot moved this from Ready To Review to Done in MAUI SDK Ongoing Sep 15, 2025
@MartyIX MartyIX deleted the feature/2024-02-27-Windows-doubleTap-PR branch September 15, 2025 16:12
@github-actions github-actions bot locked and limited conversation to collaborators Oct 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

7 participants