xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.63k stars 1.87k forks source link

[Bug] [iOS] CarouselView calculates the wrong size for its child at start #15792

Open vwensel opened 1 year ago

vwensel commented 1 year ago

Description

When starting the app, sometimes the calculation of the child of CarouselView is not done correctly.

The child of the CarouselView gets an oversized size, so that it exceeds the limits of the CarouselView and everything that goes beyond this limit is not displayed (is outside the specified size).

Steps to Reproduce

n/a (can not reproduce it for the test)

Expected Behavior

The child (StackLayout) should adapt to the CarouselView. For a width of 500 and height of 500, the child (StackLayout) should be set to 500x500.

Screenshot 1:

2

Actual Behavior

Does not adapt to the CarouselView layout. The child (StackLayout) gets an oversized size. With a width of 500 and height of 500, the child (StackLayout) gets a width of 1680 and a height of 1200.

Screenshot 2:

3

(File: CarouselViewLayout) Method: ConstrainTo - size is

  1. W:1180, H: 820
  2. W:500, H: 500 (orange box set by me)
  3. W:1680, H: 1320 (what is this here?) (comes from see Screenshot 3)

Screenshot 3: (File: ItemsViewController) Method: CheckForEmptySource

1

Basic Information

Show/Hide Code ``` mono ```

Workaround

Class: ItemsViewController Override the Methods: NumberOfSections, GetItemsCount. Copy the same Content without the Method “CheckForEmptySource()”.