maui
maui copied to clipboard
[Android] The footer in a CollectionView disappears when the number of items changes to an even number.
Description
Android only.
When there is a CollectionView (with a Header and a Footer) that is bound to an ObservableCollection, each time when the number of items in the ObservableCollection changes to an even number, the Footer disappears and appears again when the number is changed to an odd number.
https://github.com/dotnet/maui/assets/15178829/b88bb603-4bc2-467c-b45f-2152d743c4f5
Steps to Reproduce
- Open and run the repro project
- Tap on the Add / Remove item buttons
Link to public reproduction project repository
https://github.com/vecalion/maui-android-collectionview-footer-issue
Version with bug
8.0.7 SR2
Is this a regression from previous behavior?
Yes, this used to work in Xamarin.Forms
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
No response
Did you find any workaround?
Don't use an ObservableCollection. Replace the entire collection when a change is made.
Relevant log output
No response
We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.
Verified this on VS 17.10.0 Preview 2.0(8.0.10). Repro on Android 14.0-API34 with below Project: CollectionViewAndroidIssue.zip
As a workaround, I found Option 2 to be very acceptable and worked great (VS 17.10.4, MAUI 8.0.61).
Relevant docs: Microsoft Learn