Xamarin Forms Carousel does not update view since xamarin forms

Eric 1 Reputation point

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).

A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,315 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Eric 1 Reputation point

    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