Bug 42996 - CarouselView does not layout children properly on UWP
Summary: CarouselView does not layout children properly on UWP
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.1
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Chris King
Depends on:
Reported: 2016-08-02 13:50 UTC by Rob Prouse
Modified: 2017-05-05 17:33 UTC (History)
4 users (show)

Tags: ac
Is this bug a regression?: ---
Last known good build:

Xamarin Project to Repro Issue (589.54 KB, application/x-zip-compressed)
2016-08-02 13:50 UTC, Rob Prouse
Updated Repro Solution (589.52 KB, application/x-zip-compressed)
2016-08-02 15:37 UTC, Rob Prouse

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Rob Prouse 2016-08-02 13:50:30 UTC
Created attachment 16864 [details]
Xamarin Project to Repro Issue

Steps to Reproduce

1. Create a ContentPage that contains a CarouselView
2. Top child of the CarouselView is a ScrollView which contains one Label
3. The ContentPage is navigated to from another page
4. Run UWP on Desktop

I have attached a repro project.

Expected Result

The label on the first view appears at the upper right corner of the page.

Actual Result

The label appears halfway across the top of the page. Setting the background of the page to a different color shows that it is not laying out properly. My app has a Material design with a series of white StackLayouts on a grey background. It looks like they are laying out at the correct width, just offset 50% horizontally.

If you flip through the pages of the CarouselView, the first two pages are incorrect, then the remaining pages are correct. If you scroll to the fourth page and scroll back, the first two pages are now correct. I assume this is because the views are being reused.

If you resize the window on the first page, the view relays out correctly.

If the page is the first page in the Navigation stack, it does not happen, you need to navigate to the page.

If there is no ScrollView, it does not happen. Most mobile apps need a ScrollView though to handle potentially small screen sizes.

The attached demo does not show it because I minimized it to one label, but if the UWP window is smaller than the content (requires scroll?) it also does not happen.

It does not happen on Android and I have not tested iOS.


Running on Window 10 Desktop
Xamarin.Forms.CarouselView 2.3.0-pre2
Comment 1 Rob Prouse 2016-08-02 15:37:15 UTC
I over-simplified my original repro. You also need a StackLayout as a child of the ScrollView. CarouselView -> ScrollView -> StackLayout -> Label

Uploading updated repro.
Comment 2 Rob Prouse 2016-08-02 15:37:57 UTC
Created attachment 16867 [details]
Updated Repro Solution
Comment 3 Chris King 2017-05-05 17:33:35 UTC
CarouselView to be deprecated and replaced with https://github.com/xamarin/Xamarin.Forms/pull/853