Bug 21153 - ListView ItemAppearing
Summary: ListView ItemAppearing
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.1.1
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2014-07-07 13:13 UTC by Matt
Modified: 2015-04-06 09:20 UTC (History)
10 users (show)

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

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:

Description Matt 2014-07-07 13:13:29 UTC
Description of Problem: So at least for iOS, ItemAppearing seems to be called on ALL items in the ListView on creation, and then called again on all the ones on the screen (the 10-11 items). After this, ItemAppearing gets called as normal as items appear when scrolling.

Steps to reproduce the problem:
1. Creating an Enumerable of integers (or anything else) that is greater than the number of items that fit on screen and put it as the source of the ListView.
2. Create an ItemAppearingHandler for hooking up to the listview's ItemAppearing.
3. For the ItemAppearingHandler, print the item or do something to see that all the items are being called right at the beginning.

Actual Results:
All of the items event handlers gets fired off as the beginning, and then also those that are actually on the screen.

Expected Results:
Only those 10-11 items on the screen should get handled.

How often does this happen? 
Every time on iOS

Additional Information:
Comment 1 Matt 2014-07-08 16:13:26 UTC
NOTE: I'm not sure how to edit, but I should have mentioned that the ListView being used should be a custom class that inherits from ListView!
Comment 2 Rajneesh Kumar 2014-08-21 06:25:38 UTC
I have checked this issue and try to reproduce with the help provided in the bug description, but not able to reproduce. I try this issue with Xamarin.forms(Version and its working fine. I observed that when I run the application, items that are appearing on the screen(10-11 items) ItemAppearing event handlers gets fired only for them not for items thats appear when scrolling. I printed the items that gets fired. I also observed that when I scroll the items, the items comes after scrolling, ItemAppearing event handlers gets fired only for them not for items thats appear when scrolling. And all of the items not getting fired

Could you please provide us your environment info, sample project on which you are working so that we can reproduce this issue at our end.

Please let me know if I am missing anything.

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

Environment info:

=== Xamarin Studio ===

Version 5.2.1 (build 1)
Installation UUID: 011d70a5-dede-428b-ab04-ef451c2e539d
	Mono 3.8.0 ((no/62a857e)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 308000007

=== Xamarin.Android ===

Version: 4.14.0 (Enterprise Edition)
Android SDK: /Users/MM/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)
		3.2   (API level 13)
		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)
Java SDK: /usr
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

=== Apple Developer Tools ===

Xcode 5.1.1 (5085)
Build 5B1008

=== Xamarin.iOS ===

Version: (Enterprise Edition)
Hash: 606f31a
Build date: 2014-08-01 15:27:48-0400

=== Xamarin.Mac ===

Version: (Enterprise Edition)

=== Build Information ===

Release ID: 502010001
Git revision: d06832ce9807d6be24aca225457e8b37c7669f6f
Build date: 2014-08-07 12:10:47-04
Xamarin addins: 1de032531be4cecf2f39dbee3b87aac78204058c

=== Operating System ===

Mac OS X 10.9.2
Darwin MacMini.local 13.1.0 Darwin Kernel Version 13.1.0
    Thu Jan 16 19:40:37 PST 2014
    root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64
Comment 3 Rob Gibbens 2014-08-25 22:25:10 UTC
I am having the same problems.  I have created a sample app available here : https://github.com/RobGibbens/InfiniteScrolling

Xamarin Studio 5.2.1
iOS 7.1 Simulator

The sample works fine in Android. iOS will Debug.WriteLine() all of the values in the whole ListView.
Comment 4 Rui Marinho 2015-01-27 12:33:01 UTC
This issue is fixed in the public 1.3.1 release or higher version.
Comment 5 Subha 2015-04-06 09:20:34 UTC
This is occurring again in 1.4.0 - New bug reported by Martin Booth - https://bugzilla.xamarin.com/show_bug.cgi?id=27845

Workaround is to set ListView.RowHeight and also set HasUnevenRow to false - http://forums.xamarin.com/discussion/35604/listview-ios-hasunevenrows-true-and-observablecollection