maui icon indicating copy to clipboard operation
maui copied to clipboard

[Android] The footer in a CollectionView disappears when the number of items changes to an even number.

Open vecalion opened this issue 6 months ago • 1 comments

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

  1. Open and run the repro project
  2. 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

vecalion avatar Feb 17 '24 14:02 vecalion

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.

ghost avatar Feb 19 '24 15:02 ghost

Verified this on VS 17.10.0 Preview 2.0(8.0.10). Repro on Android 14.0-API34 with below Project: CollectionViewAndroidIssue.zip

XamlTest avatar Mar 25 '24 07:03 XamlTest

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

jaakkohurtta avatar Jul 24 '24 11:07 jaakkohurtta