Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] [UWP] TapGestureRecognizer for Grid does not respond to all presses if we press rapidly multiple times #11083

Open
saurabhb-optimus opened this issue Jun 17, 2020 · 2 comments

Comments

@saurabhb-optimus
Copy link

saurabhb-optimus commented Jun 17, 2020

Description

I have a Button and a Grid. Button is bind to ExecuteButtonCommand and TapGestureRecognizer for Grid is bind to ExecuteGridCommand. Now if I press button rapidly and fast, corrresponding label shows correct click counts for all the platforms i.e the command code is getting executed for the number of times click happened.

But in case of Grid, although for android and iOS this works perfectly fine. But for UWP, not all the clicks are executing the command. Example: If I tap the grid rapidly and fast lets say 6 times, then the corresponding label shows only 3 or 4 counts which means command for tapgesture is getting executed less number of times than it actually should.

Steps to Reproduce

  1. Create a Grid and bind the TapGestureRecognizer Command property to some Command lets say MyCommand in view model.
  2. Write code in the method of viewmodel that executes for MyCommand to record the click count or execution count.
  3. Run the application and rapidly press grid multiple times.
  4. Observe that in case of UWP, not all the clicks are registered and count is lesser than actual presses. However the same works fine in Android and iOS.

Expected Behavior

For UWP also all the clicks should be registered or code for the command should be executed equal to the number of times the taps were made like what happen with Android and iOS.

Actual Behavior

For UWP, not all the clicks are executing the command. Example: If I tap the grid rapidly and fast lets say 6 times, then the corresponding label shows only 3 or 4 counts which means command for tapgesture is getting executed less number of times than it actually should

Basic Information

  • Version with issue: 4.6.0.800
  • IDE: VS 2019
  • Platform Target Frameworks:
    • UWP: 18362
  • Affected Devices: Windows devices

Screenshots

GridIssue

Above in sample I created, I clicked both the button and grid 5 times fastly but for Grid not all the clicks were recorded. This is happening only for UWP platform.

Reproduction Link

Workaround

No workaround was identified.

@saurabhb-optimus saurabhb-optimus added s/unverified New report that has yet to be verified t/bug 🐛 labels Jun 17, 2020
@saurabhb-optimus saurabhb-optimus changed the title [Bug] TapGestureRecognizer for Grid is does not respond to all presses if we press rapidly multiple times [Bug] TapGestureRecognizer for Grid does not respond to all presses if we press rapidly multiple times Jun 17, 2020
@saurabhb-optimus saurabhb-optimus changed the title [Bug] TapGestureRecognizer for Grid does not respond to all presses if we press rapidly multiple times [Bug] [UWP] TapGestureRecognizer for Grid does not respond to all presses if we press rapidly multiple times Jun 17, 2020
@rmarinho
Copy link
Member

@saurabhb-optimus do you mind update a small sample to reproduce the issue?

@rmarinho
Copy link
Member

Ok i was able to reproduce this: Sounds correct this code?

	var label = new Label
			{
				HorizontalOptions = LayoutOptions.Center
			};
			var labelButton = new Label
			{
				HorizontalOptions = LayoutOptions.Center
			};

			var count = 0;
			var labelCount = 0;

			var grid = new Grid
			{
				BackgroundColor = Color.Teal,
				HeightRequest = 50,
			};

			var gesture = new TapGestureRecognizer();
			gesture.Command = new Command(() =>
			{
				count++;
				label.Text = $"{count}";
			});

			grid.GestureRecognizers.Add(gesture);

			var button = new Button()
			{
				Text= "ExecuteGrid",
				Command = new Command(() => {
					labelCount++;
					labelButton.Text = $"{labelCount}";
				}),
				HorizontalOptions = LayoutOptions.Center
			};

			var stackpanel = new StackLayout
			{
				Padding = new Thickness(60),
				HorizontalOptions = LayoutOptions.Center,
				VerticalOptions = LayoutOptions.Center
			};

			stackpanel.Children.Add(labelButton);
			stackpanel.Children.Add(button);
			stackpanel.Children.Add(label);
			stackpanel.Children.Add(grid);

			MainPage = new ContentPage
			{
				Content = stackpanel
			};

@rmarinho rmarinho added e/4 🕓 4 and removed s/unverified New report that has yet to be verified labels Jun 30, 2020
@samhouts samhouts added this to the 5.0.0 milestone Aug 13, 2020
@samhouts samhouts removed this from the 5.0.0 milestone Nov 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants