Open Enigma86d opened 1 month ago
Hi I'm an AI powered bot that finds similar issues based off the issue title.
Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!
Note: You can give me feedback by thumbs upping or thumbs downing this comment.
Verified this issue with Visual Studio 17.11.0 Preview 1.1(8.0.40 & 8.0.3). Can repro it.
According to some of the linked issues(#16137 and #16669), changing to CollectionView is a solution, this however:
Some other things that we have noticed that might be relevant:
For the original sample if you put it inside a Grid
vs a StackLayout
do you see a better result?
If you're only having issues on Android can you use a CollectionView on Android and ListView on iOS for now so that you can release?
CollectionView
on Android should work remarkably better
I am just about to leave for a week long holiday and I don't have any spare time to test, but I rememebr testing witout a stack layout (having just a ListView) and I remember that there were similar problems, but they appeared much less frequent. I will test again though when I return.
I have the same exact issue, any work around exists ?
Just checked my MAUI notes and paste the relevant ones here: • ListView (Android only): when it has a “RequestHeight” set and list scrolls, rows can appear in wrong order • ListView / CollectionView: cannot have any stack layout as parent because it will not scroll https://github.com/dotnet/maui/issues/14955 • CollectionView: runs slower than ListView + cannot pin header at top https://github.com/dotnet/maui/issues/17719; also, header seems to overflow horizontally on iOS…
Thus, the solution I adopted was to use a CollectionView which doesn't have a stack layout as any of it's parents (use Grids instead...) + because I had some issues with its header, I made a separate grid above the CollectionView instead of using its header. This solution works ok on both Android and iOS, but note that I don't have the requirment of horizontal scrooling (I am using just vertical scrool). If you need horizontal scrooling, then my solution may not be good enough.
Description
In xaml create a StackLayout and inside it a ListView which uses ViewCell. in the ViewCell put a Grid with one row and 4 columns (to hold 4 Labels). Give the ListView a relatively small height, say 100 so that the ListView would scroll vertically. In C# create a observable collection and assign it to the ItemsSource of the ListView. Add 10 items to the collection. When scrolling and tapping the ListView, some rows appear in wrong order. Also, very unfrequently, a random row may become blank, showing just a color (without any contents from the observable collection). Video showing the problem: https://www.youtube.com/watch?v=pr3PCIkgsyg At 4 min 25 sec, empty rows appear in the table: https://www.youtube.com/watch?v=pr3PCIkgsyg&t=265s The problem doesn't seem to appear on iOS.
Steps to Reproduce
Link to public reproduction project repository
https://github.com/Enigma86d/ListViewBug
Version with bug
8.0.40 SR5
Is this a regression from previous behavior?
Code worked in Xamarin Forms
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Tested on Android 12 & 8.1.0
Did you find any workaround?
No workaround found.
Relevant log output
No response
XAML
C#
C#