I have ListView with HasUnevenRows = true, ListViewCachingStrategy.RecycleElement and I override `SetupContent`.
`SetupContent` is being called each time you add an item to the ListView, which makes snes, but it's called as many times as the number of items.
So if you have zero items: add one item, 'SetupContent` is called once.
Now you add a new item (there are 2 items now) `SetupContent` is called twice, one time with `index` parameter with value 0, and the second time with `index` parameter = 2
Now you add a new item (there are 3 items now) `SetupContent` is called three times (parameter `index` is 0,1 and 2 respectively)
And so on...
can you please attach a reproduction case?
Created attachment 18128 [details]
The issue is with the 'ListViewCachingStrategy.RecycleElement'.
The issue is only with the 'ListViewCachingStrategy.RecycleElement'.
Without it set, SetupContent is called once when item is added.
The test application was created in VS2015 and uses latest 184.108.40.206-pre3 but the issue is the same with the current released version 220.127.116.11.
Look to the MainPage.xaml.cs, it's the only place where code is.
Another thing I noticed:
When tapping on an item or keeping the item pressed, `SetupContent` is repeatedly called, this time for just the tapped/pressed item, but I wonder if this right. Shouldn't `SetupContent` always be called only once for an item when its cell is created?
If the override of `SetupContent` gets called so many times, I assume so is the base.
I forgot to mention that I see the issue on Android. I haven't tested it on iOS.
iOS appears to only make one call to SetupContent. Checked against the latest 18.104.22.168-nightly.