Bug 52979 - [iOS] ListView with RowHeight does not fill available height when inside nested StackLayout
Summary: [iOS] ListView with RowHeight does not fill available height when inside nest...
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.3
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2017-03-02 16:42 UTC by Stephan Palmer
Modified: 2017-07-12 22:50 UTC (History)
4 users (show)

Tags: ios, android, uwp, nested layout, stacklayout, listview, bb, ac
Is this bug a regression?: ---
Last known good build:

Example code (567 bytes, application/octet-stream)
2017-03-02 16:42 UTC, Stephan Palmer
repro project (295.22 KB, application/x-zip-compressed)
2017-03-03 18:44 UTC, Jimmy [MSFT]

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 for Bug 52979 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Stephan Palmer 2017-03-02 16:42:46 UTC
Created attachment 20092 [details]
Example code

On iOS, ListView does not fill the available height when:

* ListView is located inside nested StackLayout
* RowHeight is set to non-zero value
* ItemSource is set

I find this behavior unexpected, because ListView will fill the available height when one of the conditions is not met (e.g. no item source, row height not used, only one StackLayout).

ListView will use the height required for the items, even zero height if the item source collection is empty. In the attached example, I expected the ListView (blue background color) to fill the complete window. It does not, thus the background color of the StackLayout is visible. When not setting RowHeight in the example, ListView fills the complete window, as expected.

I've reproduced this with:

* Xamarin.Forms
* Xamarin.Forms
* iOS 9.3
Comment 1 Stephan Palmer 2017-03-02 16:45:25 UTC
A workaround for this is to set a large enough HeightRequest (e.g. larger than window height, or just a very large number). The fill layout options seems to shrink this down to just the available height, which leads to the desired behavior in the end.
Comment 2 Jimmy [MSFT] 2017-03-03 18:44:53 UTC
Created attachment 20122 [details]
repro project

I am able to reproduce this with the project I am attaching. It seems to affect all platforms I am confirming this report so the engineering team can investigate further.

### Steps to Reproduce
1. Run the attached repro project

### Expected Results
The ListView height will fill the rest of the page. In MainPage.xaml.cs, comment out line 21 to see the expected result.

As mentioned in the description, this doesn't happen when the ListView is outside the nested StackLayout, regardless of RowHeight being set or not. You can test this by uncommenting line 12 in MainPage.xaml.

### Actual Results
The ListView height does not fill the page.

### Version Info
Tested with Forms