Bug 35286 - StackLayout does not have a correct width if it contains a word wrapped label. On iOS only.
Summary: StackLayout does not have a correct width if it contains a word wrapped label...
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS ()
Version: 1.5.1
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-10-27 05:29 UTC by softlion
Modified: 2016-01-20 15:55 UTC (History)
1 user (show)

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

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:
Status:
RESOLVED FIXED

Description softlion 2015-10-27 05:29:03 UTC
<package id="Xamarin.Forms" version="1.5.1.6471" targetFramework="xamarinios1" />


    <Grid WidthRequest="100" HeightRequest="50">

        <!-- StackLayout does not get a correct width (it stays with its full width) if Label changes its width on the 2nd pass of the Layout, on iOS only. -->
        <StackLayout HorizontalOptions="Center" Padding="5" BackgroundColor="Red">
            <Label Text="FirstLine SecondLineWrapped" VerticalOptions="Center" 
                                FontAttributes="Bold" FontSize="15" XAlign="Center" BackgroundColor="Yellow" />
        </StackLayout>

    </Grid>
Comment 1 softlion 2015-10-27 05:30:11 UTC
StackLayout gets a width if 100, instead of the width of the wrapped Label which is < 100.

So StackLayout is never centered horizontally in the grid.
Comment 2 softlion 2015-10-27 05:35:50 UTC
The same code using a Grid works as expected:

<Grid WidthRequest="100" HeightRequest="50">

       <Grid HorizontalOptions="Center" Padding="5">
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
          </Grid.ColumnDefinitions>
            <Label Text="FirstLine SecondLineWrapped" VerticalOptions="Center" FontAttributes="Bold" FontSize="15" XAlign="Center" />
        </Grid>
</Grid>
Comment 3 Stephane Delcroix 2016-01-20 15:55:38 UTC
This issue was fixed around the time we released the 2.0 version of XF.