Skip to content

[iOS, MacCatalyst] CarouselView sizing issue when nested in StackLayout #12911

Closed as not planned

Description

@AlexeyStarkov

Description

The size of CarouselView is calculated wrong when it's nested in StackLayout. It seems like CarouselView size is constrained by page (or even screen) size instead of the parent element's size. It works well on Android. MacCatalyst is also affected.

Here is a code of a sample page demonstrating the issue:

     <Grid RowDefinitions="*, *, *, *">
        <Label Grid.Row="0" Text="Row 0"/>

        <StackLayout Grid.Row="1">
            <CarouselView x:Name="Carousel">
                <CarouselView.ItemTemplate>
                    <DataTemplate>
                        <Border Margin="10" BackgroundColor="Grey">
                            <Label TextColor="Red" Text="{Binding .}" />
                        </Border>
                    </DataTemplate>
                </CarouselView.ItemTemplate>
            </CarouselView>

            <BoxView HeightRequest="20" Color="Purple"/>
        </StackLayout>

        <Label Grid.Row="2" Text="Row 2" />
        <Label Grid.Row="3" Text="Row 3" />
    </Grid>

Screenshot 2023-01-26 at 00 20 23

Screenshot 2023-01-26 at 00 20 49

I didn't test it on Windows and other platforms like Tizen/Linux.

Side note: My assumption is that the there is some problem related to ItemsView because similar bugs for CollectionView has been reported and both CollectionView and CarouselView are derived from ItemsView.

Steps to Reproduce

  1. Open reproduction project
  2. Launch the application on iOS or MacCatalyst

Link to public reproduction project repository

https://github.com/AlexeyStarkov/MAUI_CarouselView_Sizing_Issue
#12911 (comment)

Version with bug

.NET 6.0,
.NET 7.0
.NET 8.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

iOS, macOS

Affected platform versions

iOS 16.2, macOS Ventura 13.1

Did you find any workaround?

No response

Relevant log output

No response

Activity

  1. added
    t/bug
    on Jan 25, 2023
  2. changed the title [-][iOS, MacCatalyst] Carousel View sizing issue when nested in StackLayout[/-] [+][iOS, MacCatalyst] CarouselView sizing issue when nested in StackLayout[/+] on Jan 25, 2023
  3. added
    area-controls-collectionview
    area-layout
    on Jan 26, 2023
  4. added this to the Backlog milestone on Jan 26, 2023
  5. added
    s/triaged
    s/verified
    on Jun 8, 2023
  6. jinxinjuan commented on Jun 8, 2023

    @jinxinjuan

    Verified this issue with Visual Studio Enterprise 17.7.0 Preview 1.0. Can repro on iOS and Maccatalyst platform with sample project.
    MAUI_CarouselView_Sizing_Issue

  7. dotMorten commented on Jun 25, 2023

    @dotMorten
    Contributor

    I'm seeing the same thing - both .NET 7 and .NET 8 Preview 5. Haven't found a good way to work around this.

  8. evgenyKozlov1996 commented on Dec 13, 2023

    @evgenyKozlov1996

    The same issue verified in .NET 8.0.3

  9. willcorum commented on Feb 29, 2024

    @willcorum

    Same in 8.0.6. Unless you specify a height on the carousel and the data template item the carousel tries to occupy all the vertical space. Android is not affected. Setting a height doesn't allow the control to resize itself based on variable text content. Pretty frustrating. You can replicate this by removing the height settings from the HorizontalTemplateLayoutPage.xaml view in the demo. https://github.com/dotnet/maui-samples/tree/main/8.0/UserInterface/Views/CarouselViewDemos

  10. maxiking01 commented on Mar 6, 2024

    @maxiking01

    Same on 8.0.7 . The problem only occurs on iOS. Did not test on MacCatalyst. On Android CarouselView works properly.

  11. added
    partner/cat 😻
    migration-compatibility
    on May 21, 2024
  12. coop-tim commented on Jul 1, 2024

    @coop-tim

    +1 having to put fixed height on carousels because of this bug is very frustrating

  13. added
    s/try-latest-version
    on Aug 13, 2026
  14. dotnet-policy-service commented on Aug 13, 2026

    @dotnet-policy-service
    Contributor

    Hi @@AlexeyStarkov. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version.

    You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository.

    This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

  15. dotnet-policy-service commented on Aug 13, 2026

    @dotnet-policy-service
    Contributor

    Hi @AlexeyStarkov. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version.

    You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository.

    This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

  16. removed
    s/try-latest-version
    on Aug 14, 2026
  17. kubaflo commented on Oct 10, 2026

    @kubaflo
    Contributor

    Thank you for taking the time to report this and share the details.

    We requested a check on the latest version on August 13, 2026, and there has been no subsequent human follow-up in this thread. We are closing this report as not planned at this time because the requested current-version confirmation has not arrived and we are not scheduling further investigation from this thread.

    This is a backlog-prioritization decision, not evidence that the reported behavior is fixed or that the original report lacked value. If the issue remains a blocker on a supported current .NET MAUI version, please comment here with that version and the reproduction result so we can reassess it. An existing sample, attachment, code snippet, or repository test can be reused; a new repository is not required.

  18. locked and limited conversation to collaborators on Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-controls-collectionviewarea-layoutdelighter-sclayout-stackmigration-compatibilitypartner/cat 😻platform/ioss/triageds/verifiedt/bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions