Bug 51179 - StackLayout ignoring EndAndExpand on iOS in certain scenarios
Summary: StackLayout ignoring EndAndExpand on iOS in certain scenarios
Status: CONFIRMED
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS ()
Version: 2.3.3
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-01-03 01:55 UTC by Kent
Modified: 2018-02-22 04:46 UTC (History)
4 users (show)

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


Attachments
Repro project (296.82 KB, application/x-zip-compressed)
2017-01-03 01:55 UTC, Kent
Details


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 51179 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:
Status:
CONFIRMED

Description Kent 2017-01-03 01:55:08 UTC
Created attachment 19054 [details]
Repro project

Consider the following XAML:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:StackLayoutBugRepro"
             x:Class="StackLayoutBugRepro.MainPage">

    <StackLayout Margin="0,20,0,0">
        <!-- works (by virtue of no wrapping) -->
        <StackLayout Orientation="Horizontal">
            <Switch/>
            <Label Text="Some text"/>
            <Button Text="A Button" HorizontalOptions="EndAndExpand"/>
        </StackLayout>

        <!-- works (by virtue of no switch) -->
        <StackLayout Orientation="Horizontal">
            <Label Text="Some longer text that wraps over two lines"/>
            <Button Text="A Button" HorizontalOptions="EndAndExpand"/>
        </StackLayout>

        <!-- does not work -->
        <StackLayout Orientation="Horizontal">
            <Switch/>
            <Label Text="Some longer text that wraps over two lines"/>
            <Button Text="A Button" HorizontalOptions="EndAndExpand"/>
        </StackLayout>
    </StackLayout>
</ContentPage>

The combination of wrapping text and an initial control (a Switch in this example) is causing the third scenario to fail. That is, the Button does not expand to take up the remaining available space in the StackLayout. The same code seems to work fine on Android.

A repro project is attached.
Comment 1 Enrique Zavaleta 2018-02-22 04:46:31 UTC
Is there any solution or workaround, it is the same result if I use more nested StackLayout, even if I use EndAndExpand options, but as Kent said, it works fine in Android