Eric-9645 avatar image
0 Votes"
Eric-9645 asked RobCaplan commented

Xamarin Forms Carousel does not update view since xamarin forms

Hi everybody
Xamarin Adroid:
I have a carousel showing pictures. When i add pictures Itemsource is updated (observablecollection).
With Xamarin forms nuget package everything works fine but since refresh is not correct. issue is the same with the last 5.0.02401.
Sometimes nothing is drawn, sometimes only few items are drawns (not the complete collection). When i debug, i see that collection applied on itemsource is good, it seems to be a drawing problem

If someone on the developpement team can take a look about this issue, it could be great. Thanks

Now i use android 12 SDK and target 12, but it is the same with android 11. issue is not device dependant (android 9 to 12).

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

This sounds similar to
[Bug] [Android] CarouselView stops displaying content when source changes.

The symptom isn't an exact match, but it's close enough that it may be to be the same underlying problem.

If you can confirm and add your details to the bug report that may help in finding and resolving it. If you think it's different you can file a bug with your specific details. Please include exact repro steps - how exactly are you refreshing (via RefreshView? Updating the bound data? Something else?), how is the CarouselView set up (partial display could be related to incremental data virtualization, if you're using that)? Etc.

How to write a quality question
Xamarin.Forms Bug Reproduction Guidelines

0 Votes 0 ·

1 Answer

Eric-9645 avatar image
0 Votes"
Eric-9645 answered RobCaplan commented

I have made a new simpliest project and i have same behavior.

In the view a simple carousel with label:

          <DataTemplate x:Key="PostItemTemplate">
     <Grid  x:Name="GridGlob" BackgroundColor="Green" Margin="5">
                  <Label Grid.Row="1" Text="{Binding .}" />

<CarouselView BackgroundColor="Pink" ItemTemplate="{DynamicResource PostItemTemplate}"
x:Name="carou" Loop="False" ItemsSource="{Binding LesItems}" PeekAreaInsets="50">

in the viewmodel

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

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

       ObservableCollection<string> obsCol = new ObservableCollection<string>();
         LesItems = obsCol;

since Xamarin forms
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
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 nex one and drawing all items.

Thanks for your help

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

This appears to be clarification to your question rather than an answer. Can you please edit it into your initial question so it doesn't confuse others who run into similar problems?

Please see: When to use answers or comments

Since you're replacing the BindingContext here rather than adding & removing to the existing one this sounds very similar to
the repro steps in and I would recommend adding your repro notes to that. You can compare your results with the ones reported there, and if you think they're sufficiently different you can file yours as a separate issue in that repo.

As mentioned in the How to write a quality question FAQ, Don't use <Q&A> to report product bugs or feature requests

This is a site for support, so please use the right site to requests new feature requests about a Microsoft product or report any bugs. This will ensure that the experts can focus on resolving user's problems instead of having to redirect you to the right site.

0 Votes 0 ·