Bug 42727 - Empty StackLayout with large HeightRequest overflows boundary of containing StackLayout
Summary: Empty StackLayout with large HeightRequest overflows boundary of containing S...
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.0
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-07-22 07:25 UTC by Falko Schindler
Modified: 2018-02-20 19:28 UTC (History)
5 users (show)

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

Montage of code and iOS screenshot with and without Label (163.67 KB, image/png)
2016-07-22 07:25 UTC, Falko Schindler

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 Falko Schindler 2016-07-22 07:25:56 UTC
Created attachment 16754 [details]
Montage of code and iOS screenshot with and without Label

I've got a Label in a StackLayout in a StackLayout:

    MainPage = new ContentPage {
        Padding = 20,
        Content = new StackLayout {
            BackgroundColor = Color.Silver,
            Padding = 10,
            Children = {
                new StackLayout {
                    BackgroundColor = Color.Yellow,
                    HeightRequest = 1000,
                    Children = {
                        new Label {
                            Text = "Label",
                            BackgroundColor = Color.Red,

Due to the large HeightRequest the inner StackLayout fills the whole space available. But if we remove its child Label, the StackLayout grows beyond the size of its parent StackLayout.

The attached screenshot demonstrates the behavior.

We'd expect the HeightRequest to be evaluated independently of the containing Children.

The bug occurs on both iOS and Android.
Comment 1 Falko Schindler 2016-07-22 07:47:19 UTC
Another observation: A Button acts differently than a Label.

* no child: overflow
* Label:    no overflow
* Button:   overflow
Comment 2 Paul Brenner 2018-02-19 20:22:04 UTC
See https://github.com/xamarin/Xamarin.Forms/issues/1924
Comment 3 Samantha Houts [MSFT] 2018-02-20 19:28:38 UTC
Please follow https://github.com/xamarin/Xamarin.Forms/issues/1924 for updates. Thanks!