Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] [Android] CarouselView stops displaying content when source changes. #15231

Closed
GalaxiaGuy opened this issue Mar 15, 2022 · 4 comments
Closed

Comments

@GalaxiaGuy
Copy link
Contributor

Description

Updating the ItemsSource on a CarouselView makes the content disappear on Android. I found this issue while investigating #15082. On 5.0.0.2012, updating the ItemsSource causes the Position to stop updating. When I updated to 5.0.0.2337, it also stopped displaying content.

Steps to Reproduce

  1. Create a CarouselView with an ItemsSource set to something.
  2. Update the ItemsSource to a new value.

Expected Behavior

The carousel shows the new content.

Actual Behavior

The carousel is blank

Basic Information

  • Version with issue: 5.0.0.2337
  • Last known good version: 5.0.0.2012

https://github.com/GalaxiaGuy/xf-bugs/tree/bug/broken-carouselview

@GalaxiaGuy GalaxiaGuy added s/unverified New report that has yet to be verified t/bug 🐛 labels Mar 15, 2022
@GalaxiaGuy
Copy link
Contributor Author

After a bit of investigation, this may only happen if you update the items source by changing the binding context.

@RicolabRico
Copy link

Hi,
I have same kind of behavior depending on Xamarin form version.
With old Xamarin forms 5.0.0.224 everithing works fine (changing entire itemsource, refresh perfectly view).Since Xamarin forms 5.0.0.2291, strange behavior like described here.

I have made a simple project and i have same behavior.

In the view a simple carousel with label:

<ContentPage.Resources>







</ContentPage.Resources>

in the viewmodel

 private ObservableCollection<string> _LesItems;
 public ObservableCollection<string> LesItems
 {
     get { return _LesItems; }
     set { _LesItems = value;
         OnPropertyChanged();
     }
 }

Now just add a button in the view with command binding viewmodel doing this:

   ObservableCollection<string> obsCol = new ObservableCollection<string>();
     obsCol.Add("ble");
     obsCol.Add("sdf");
     obsCol.Add("erz");
     obsCol.Add("grz");
     obsCol.Add("efs");
     obsCol.Add("new");
     LesItems = obsCol;

since Xamarin forms 5.0.0.2291:
First time, everything is good, 6 items are drawn . If you clic again , You will see only 4 items and most of time only 1 item (debug show that "LesItems" contains 6 items but only 1 is drawn)

With old Xamarin forms 5.0.0.224:
It always works fine. No matter number of clic. all items are drawn that should be normal behaviour because each time you clic it must replace collection by next one and drawing all items.

@jfversluis
Copy link
Member

Should be fixed by #15266 closing under this assumption, let me know if that's not the case

@stoff99
Copy link

stoff99 commented Aug 9, 2022

I have to say thank you! THANK YOU!
I stuck in this bug for a week now and didn't realize that i'm using an older XF package version >.<
I also was not able to find this bug here in git. Maybe my wording ...
Thanks again for this fix! :) 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/carouselview p/Android s/unverified New report that has yet to be verified t/bug 🐛
Development

No branches or pull requests

4 participants