Skip to content

[iOS] CarouselView ItemSpacing property in ItemsLayout not working with CV2 #27025

@anandhan-rajagopal

Description

@anandhan-rajagopal

Description

The ItemSpacing property of LinearItemsLayout within a CarouselView is not functioning as expected in .NET MAUI, the items in the CarouselView are still displayed without any visible spacing between them. This issue replicates in CV2, in CV1 its works as expected.

Note: While fixing this issue enable the test case from HostApp: Issue25192.

CV2: Image

CV1: Image

<Grid>
      <CarouselView Margin="2,9,2,20"
                    HeightRequest="180"
                    Loop="False"
                    PeekAreaInsets="20"
                    VerticalOptions="End">
          <CarouselView.ItemsSource>
              <x:Array Type="{x:Type x:String}">
                  <x:String>Item1</x:String>
                  <x:String>Item2</x:String>
                  <x:String>Item3</x:String>
              </x:Array>
          </CarouselView.ItemsSource>
          <CarouselView.ItemsLayout>
              <LinearItemsLayout ItemSpacing="100"
                                 Orientation="Horizontal"
                                 SnapPointsAlignment="Center"
                                 SnapPointsType="MandatorySingle"/>
          </CarouselView.ItemsLayout>
          <CarouselView.ItemTemplate>
              <DataTemplate
                  x:DataType="{x:Null}">
                  <Border BackgroundColor="Red"
                          Stroke="Blue"
                          StrokeShape="RoundRectangle 12"
                          StrokeThickness="0">
                      <Grid Margin="16"
                            ColumnDefinitions="*,*"
                            ColumnSpacing="15"
                            RowDefinitions="*,*,36"
                            RowSpacing="15">
                          <VerticalStackLayout
                              Grid.Row="0"
                              Grid.ColumnSpan="2"
                              VerticalOptions="Center">
                              <Label FontSize="16"
                                     LineBreakMode="WordWrap"
                                     Text="DummyLabel"
                                     TextColor="#333333"
                                     VerticalOptions="Center"/>
                              <Label FontFamily="Medium"
                                     FontSize="14"
                                     LineBreakMode="WordWrap"
                                     Text="DummyDesc"
                                     TextColor="#5F5E6A"/>
                          </VerticalStackLayout>

                          <Border Grid.Row="1"
                                  Grid.Column="0"
                                  BackgroundColor="LightGray"
                                  HorizontalOptions="Start"
                                  StrokeShape="RoundRectangle 12"
                                  StrokeThickness="0"
                                  VerticalOptions="Center">
                              <Label Grid.Column="1"
                                     FontFamily="Regular"
                                     FontSize="14"
                                     Margin="6"
                                     AutomationId="{Binding .}"
                                     Text="{Binding .}"
                                     TextColor="Black"
                                     VerticalOptions="Center"/>
                          </Border>

                          <Border Grid.Row="1"
                                  Grid.Column="1"
                                  BackgroundColor="#e8fccf"
                                  HorizontalOptions="Center"
                                  StrokeShape="RoundRectangle 12"
                                  StrokeThickness="0"
                                  VerticalOptions="Center">
                              <Label Grid.Column="1"
                                     FontFamily="Regular"
                                     FontSize="14"
                                     Margin="6"
                                     Text="{Binding .}"
                                     TextColor="#155d27"
                                     VerticalOptions="Center"/>
                          </Border>

                          <Label Grid.Row="2"
                                 FontSize="24"
                                 HorizontalOptions="Start"
                                 Text="I am here"
                                 TextColor="Black"
                                 VerticalOptions="Center"/>

                          <Button Grid.Row="2"
                                  Grid.Column="1"
                                  BackgroundColor="White"
                                  BorderWidth="2"
                                  TextColor="Black"
                                  Text="Click me"
                                  VerticalOptions="Center"/>
                      </Grid>
                  </Border>
              </DataTemplate>
          </CarouselView.ItemTemplate>
      </CarouselView>
  </Grid>


Steps to Reproduce

  1. Deploy attached sample.
    MauiApp1.zip

CV1 Behavior: The items in the CarouselView should be displayed with the specified spacing between them.

CV2 Behavior: The items in the CarouselView are displayed without any visible spacing, ignoring the ItemSpacing property value.

Link to public reproduction project repository

No response

Version with bug

9.0.22 SR2.2

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

iOS, macOS

Affected platform versions

iOS 18.0

Did you find any workaround?

No response

Relevant log output

Metadata

Metadata

Assignees

Labels

area-controls-collectionviewCollectionView, CarouselView, IndicatorViewcollectionview-cv2i/regressionThis issue described a confirmed regression on a currently supported versionpartner/syncfusionIssues / PR's with Syncfusion collaborationplatform/iosplatform/macosmacOS / Mac Catalysts/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

Type

No type

Projects

Status

Todo

Relationships

None yet

Development

No branches or pull requests

Issue actions