Bug 33841 - On iOS, Label with StartAndExpand HorizontalOptions does not expand if multiline (word wrap)
Summary: On iOS, Label with StartAndExpand HorizontalOptions does not expand if multil...
Status: RESOLVED DUPLICATE of bug 28650
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS (show other bugs)
Version: 1.5.0
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-09-10 04:44 UTC by Thibault Durand
Modified: 2016-11-15 02:54 UTC (History)
7 users (show)

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


Attachments
Zipped simple Xforms project to show the bug. (334.57 KB, application/zip)
2015-09-10 04:44 UTC, Thibault Durand
Details

Description Thibault Durand 2015-09-10 04:44:20 UTC
Created attachment 12847 [details]
Zipped simple Xforms project to show the bug.

*** Overview ***

When adding a left-aligned Label (LayoutOptions.StartAndExpand) and a right-aligned Switch (LayoutOptions.End) to an horizontal StackLayout: 
This works well in all cases on Android but on iOS the label does not expand any more when the text contains line breaks due to word wrapping.
In the attached zip file you can find a simple sample project using Xamarin.Forms 1.4.4.6392 as well as a PNG image illustrating the issue. 
I have tested the issue with the following versions: 
Xamarin.Forms 1.3.5.6337
Xamarin.Forms 1.4.3.6376
Xamarin.Forms 1.4.4.6392
Xamarin.Forms 1.5.0.6404-pre3
All versions are affected in the same way. 

This could be a duplicate of #28650 or #31128


*** Steps to Reproduce ***

1. Start the attached sample app on iPhone simulator 5S or 6. 


*** Environment Info ***

Xamarin Studio
Version 5.9.5 (build 9)
Installation UUID: b3819a7b-8a99-45e7-a65c-7d612aaa73f1
Runtime:
	Mono 4.0.3 ((detached/d6946b4)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400030020

Apple Developer Tools
Xcode 6.4 (7720)
Build 6E35b

Xamarin.iOS
Version: 8.10.4.46 (Business Edition)
Hash: 2c66d2f
Branch: master
Build date: 2015-08-04 13:52:25-0400

Xamarin.Android
Version: 5.1.5.3 (Business Edition)
Android SDK: /Users/thidu06/Library/Android/sdk/
	Supported Android versions:
		4.1 (API level 16)
		4.2 (API level 17)
		5.0 (API level 21)
		5.1 (API level 22)
Java SDK: /usr
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

Xamarin Android Player
Not Installed

Xamarin.Mac
Version: 2.0.2.111 (Starter Edition)

Build Information
Release ID: 509050009
Git revision: b99cb19a1d3b15d8980c4616f13f837457e5b292
Build date: 2015-07-28 02:01:44-04
Xamarin addins: d53d6eceb828422f3d4aff8547f2f6bab6c9ea58



Operating System
Mac OS X 10.10.5
Darwin dhcp-16-23.it.liu.se 14.5.0 Darwin Kernel Version 14.5.0
    Wed Jul 29 02:26:53 PDT 2015
    root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64
Comment 1 E.Z. Hart [MSFT] 2016-04-13 18:55:59 UTC
Still occurring in 2.2.0.5-pre2, still happens with "LayoutOptions.FillAndExpand"
Comment 2 Falko Schindler 2016-06-29 08:19:11 UTC
Same here with 2.3.0.49. Very annoying.
Does anyone know a reliable workaround?
Comment 3 Falko Schindler 2016-06-29 08:23:04 UTC
Just because I've created it for myself anyway, here is a more compact test page:

    MainPage = new ContentPage {
        Content = new StackLayout {
            Orientation = StackOrientation.Horizontal,
            VerticalOptions = LayoutOptions.CenterAndExpand,
            BackgroundColor = Color.Yellow,
            Children = {
                new Label {
                    Text = "This simple dummy label contains extraordinarily many words.",
                    BackgroundColor = Color.Silver,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                },
                new Label {
                    Text = "!",
                    BackgroundColor = Color.Silver,
                },
            },
        },
    };

The dummy text is somehow tuned to overstate the case on the small screen of an iPhone 4s.
Comment 4 Thibault Durand 2016-06-29 08:25:54 UTC
Workaround: 
You can probably use a Grid instead of StackLayout as proposed by James Montemagno here: 
http://forums.xamarin.com/discussion/50299/bug-ios-label-with-startandexpand-horizontaloptions-does-not-expand-if-multiline-word-wrap#latest

At least it did solve it for me. 

Regards,
Comment 5 Thibault Durand 2016-06-29 08:26:47 UTC
Permalink to forum should have been: 
http://forums.xamarin.com/discussion/comment/152969/#Comment_152969
Comment 6 Falko Schindler 2016-06-29 08:31:11 UTC
Thanks! I'll try the Grid approach. :)

I used to hack around this problem with

    WidthRequest = 1e10;

But it possibly messes with other views that request a certain width.
Comment 7 Ray Kelly 2016-07-16 14:42:27 UTC
Can we please get this fixed?  Grid does not work when its in a ListView with UnevenRows (another bug that is logged).  Thank you.
Comment 8 Paul DiPietro [MSFT] 2016-11-15 02:54:05 UTC

*** This bug has been marked as a duplicate of bug 28650 ***

Note You need to log in before you can comment on or make changes to this bug.