Bug 26761 - [iOS] ListView TapGestureRecognizer Issue
Summary: [iOS] ListView TapGestureRecognizer Issue
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.3.3
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Parmendra Kumar
URL:
: 27254 ()
Depends on:
Blocks:
 
Reported: 2015-02-04 18:05 UTC by Adrian
Modified: 2015-03-22 06:44 UTC (History)
13 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Test case reproducing the described defect (162.27 KB, application/x-gzip)
2015-02-12 03:03 UTC, pith
Details
iOS ViewCell TapGestureRecognizer BindingContext mismatch (76 bytes, text/plain)
2015-02-20 17:24 UTC, Chris Riesgo
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Adrian 2015-02-04 18:05:46 UTC
I noticed a new bug starting from 1.3.2 and still present in 1.3.3-pre2 on iOS. It's critical for me.
Android is not affected. The control works in 1.3.1 on iOS as well.

It's about Recycling Items and the TappedReconizer in a ListView.

Imagine a listbox, where each item/row (ViewCell) contains a stackpanel with 3 images (so basically it's a gridview) with uneven hights. Each of that images do have a TappedReconizer to be able to detect touches on the image. the binded reconizer has an commandparameter (a view model - containing the source of the image and others).

on 1.3.2-pre on ios, the tapped event has a wrong commandparameter.
Maybe because of object recycling? or wrong calculations in scrolling?

The first Entries are okay - but on scrolling down the issue starts...
in companion with that, images blink (old/new value)
Comment 1 Sadik Ali 2015-02-06 00:55:12 UTC
We have checked this issue and unable to reproduce this issue.

Could you please provide us Sample code, Build Info. So that we can reproduce this issue  at our end.

You can copy build info from Xamarin Studio-> About Xamarin Studio.
Comment 2 pith 2015-02-12 03:03:57 UTC
Created attachment 9787 [details]
Test case reproducing the described defect

A minimal test case reproducing the described behaviour.

This app has a single Page containing a ListView. Each cell in the list view renders a label describing the data item (a fruit name) and a large red number that is incremented by a TapGestureRecognizer on the ViewCell. In iOS with Xamarin Forms 1.3.3 (or above), the TapGestureRecognizer works correctly for ViewCells which are in view before scrolling, but once you scroll then the tap events start acting on the wrong data item.

This behaviour did not occur in 1.3.1 or earlier.

Xamarin Studio Info

Xamarin Studio
Version 5.7.1 (build 17)
Installation UUID: 211be43b-30d0-47d1-9ca7-b98a9fe42626
Runtime:
	Mono 3.12.0 ((detached/de2f33f)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312000076

Apple Developer Tools
Xcode 6.1.1 (6611)
Build 6A2008a

Xamarin.iOS
Version: 8.6.1.20 (Indie Edition)
Hash: 3b3ef43
Branch: 
Build date: 2015-01-24 09:42:21-0500

Xamarin.Android
Version: 4.20.0.28 (Indie Edition)
Android SDK: /Users/cameron/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		4.0.3 (API level 15)
		4.4   (API level 19)
		5.0   (API level 21)
Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

Xamarin.Mac
Not Installed

Build Information
Release ID: 507010017
Git revision: 0bc7d3550b6b088ac25b08dcf7bbe73bcc8658b3
Build date: 2015-02-03 19:43:29-05
Xamarin addins: f7b7d34419c9ec24501bfa7c658e80a6305613e0

Operating System
Mac OS X 10.10.2
Comment 3 PJ 2015-02-12 06:16:51 UTC
Thanks for the info -> NEW
Comment 4 Daniele Parisi 2015-02-12 09:43:25 UTC
I think I have a similar bug about Recycling Items and the TapGestureRecognizer in a ListView.
Today I upgraded starting from 1.2.3.6257 to 1.3.3.6323 first (I found the problem) and then to 1.3.4.6329-pre3 (the problem occured again).

Also for me the Android version is not affected. Using the previous release (1.2.3.6257) also the iOS app worked well.

The scenario is the following:

The first time that the list is loaded all works fine but if the list changes (my app allows user to navigate into folders and files) and I click the contextual menu icon(each row has one of these and the TapGestureRecognizer is related to it)
I found the previuos item in the BindingContext.
The strange thing is that the BindingContext contains the right item. I sure about this because other visual element of the row are correct (ie icon, description, etc) 

Any suggestion?
Thanks
Daniele
Comment 5 Adrian 2015-02-12 09:50:47 UTC
@Daniele: I implemented an ugly workaround to be able to proceed:

In a custom renderer, I read the X/Y Pixels of the Tap Event. In the ListView.Selected Item, I evaluate the tapped item by calculate the location-info. It works because it's a balanced grid of three items and is compatible to WP8/iOS/Android.

Cheers, Adrian
Comment 6 Daniele Parisi 2015-02-12 10:44:13 UTC
@Adrian : thanks for your suggestion:
I'm sure that is a good workaround but I have no idea about the way to do this.
I hope that the bug will fixed soon.
Thank you again
Daniele
Comment 7 Parmendra Kumar 2015-02-12 13:44:55 UTC
I have checked this issue with attached project in comment #2. And I am getting same behavior mentioned in the bug description.

Screencast: http://www.screencast.com/t/WJupkpOJGC

Device Logs Xcode : https://gist.github.com/Parmendrak/e76643dd3fe71d6a5de6
Simulator Log: https://gist.github.com/Parmendrak/e0763ab7dd5b681ab8c4
ApplicationOutput Log: https://gist.github.com/Parmendrak/dfc57d8cfd6192aa7e29
IDE Log: https://gist.github.com/Parmendrak/57d70b77c31a8ba32846

Note: I am getting same behavior on VS.

Please us know if I can give more information regarding this.

Environment info:

Regression status: Its working fine with Xamarin.Forms version: 1.3.1.6296 

Getting bug on Xamarin.Forms: 1.3.2.6316, 1.3.3.6323 and 1.3.4.6329-pre3

=== Xamarin Studio ===

Version 5.7.1 (build 17)
Installation UUID: 1a096c6f-0678-402e-89b2-a2c10f7e80e4
Runtime:
	Mono 3.12.0 ((detached/de2f33f)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312000076

=== Apple Developer Tools ===

Xcode 6.1.1 (6611)
Build 6A2008a

=== Xamarin.iOS ===

Version: 8.6.1.20 (Business Edition)
Hash: 3b3ef43
Branch: 
Build date: 2015-01-24 09:42:21-0500

=== Xamarin.Mac ===

Version: 1.12.0.6 (Business Edition)

=== Xamarin.Android ===

Version: 4.20.0.28 (Business Edition)
Android SDK: /Users/360_macmini/Desktop/android-sdk-macosx
	Supported Android versions:
		2.1    (API level 7)
		2.2    (API level 8)
		2.3    (API level 10)
		3.1    (API level 12)
		4.0    (API level 14)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
Java SDK: /usr
java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)

=== Build Information ===

Release ID: 507010017
Git revision: 0bc7d3550b6b088ac25b08dcf7bbe73bcc8658b3
Build date: 2015-02-03 19:43:29-05
Xamarin addins: f7b7d34419c9ec24501bfa7c658e80a6305613e0

=== Operating System ===

Mac OS X 10.9.4
Darwin ShrutiMac.local 13.3.0 Darwin Kernel Version 13.3.0
    Tue Jun  3 21:27:35 PDT 2014
    root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64
Comment 8 Chris Riesgo 2015-02-20 17:24:14 UTC
Created attachment 9955 [details]
iOS ViewCell TapGestureRecognizer BindingContext mismatch
Comment 9 Chris Riesgo 2015-02-20 17:25:02 UTC
I've attached an additional repro case. Hopefully it will help.
Comment 10 Parmendra Kumar 2015-02-26 10:17:24 UTC
*** Bug 27254 has been marked as a duplicate of this bug. ***
Comment 11 Jason Smith [MSFT] 2015-03-02 03:29:02 UTC
Should be fixed in 1.3.5
Comment 12 troywillmot 2015-03-22 06:42:45 UTC
Hi,

I'm pretty sure I'm suffering from the same problem (or at least the same symptom) in Windows Phone. Will this fix apply there too? Also I see the fix is listed as being in 1.3.5 but I don't see even a pre-release version of that available (2 pre release builds of 1.4 exist by the looks of it). Any idea when this will ship? It's a pretty serious bug, especially for LOB apps.

Thanks.
Comment 13 troywillmot 2015-03-22 06:44:33 UTC
Wait, sorry, misread the version numbers. It looks like this fix has already shipped, but I am still seeing it in my WP app. I will double check the version of XF I've got in the app tomorrow.