Bug 36553 - WordWrap of Label fails
Summary: WordWrap of Label fails
Status: CONFIRMED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.0.0
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-12-03 18:24 UTC by John Hardman
Modified: 2017-09-21 08:23 UTC (History)
10 users (show)

Tags: uwp, WordWrap, LineBreakMode, ac, label, retest
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 for Bug 36553 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 John Hardman 2015-12-03 18:24:48 UTC
When developing on WinPhone 8.1, I noticed that text was not being word-wrapped, even though the same text is word-wrapped on Android and iOS.

For convenience, I investigated on WinPhone 8.0, which exhibits the same problem. The code sample below wraps text on Android but does not on WinPhone.

//============================================================
// generated using John Hardman's Xamarin.Forms dissassembler
//============================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Xamarin.Forms;

namespace App1
{
    public class App : Application
    {
        public App()
        {
            MainPage = new ContentPage
            {
                Title = "ObfuscatedString1",
                Content = new StackLayout
                {
                    Orientation = StackOrientation.Horizontal,
                    HorizontalOptions = LayoutOptions.Start,
                    VerticalOptions = LayoutOptions.FillAndExpand,
                    Children = // of StackLayout
                    {
                        new Label
                        {
                            LineBreakMode = LineBreakMode.WordWrap,
                            Text="ObfuscatedString14 is a long string that we would expect to word wrap on all but the widest screens. Certainly on a phone, this should wrap.",
                            HorizontalOptions = LayoutOptions.Start,
                            VerticalOptions = LayoutOptions.CenterAndExpand
                                                                                                    
                        } // Label
                    } // StackLayout
                } // StackLayout
            }; // ContentPage
        } // constructor
    } // class
} // namespace
Comment 2 Matthew Regul 2015-12-28 14:42:49 UTC
Issue also appears when using XAML & Grids
- Xamarin Forms 2.0.0.6490
- When using Grids, the issue may be related to the use of a star (*) in grid's Column definition.
- Label will wrap properly if it's not in a ViewCell.
- Workaround, provide a WidthRequest to the contentView, which gets complicated when trying to support both landscape and portrait layouts.

Sample Code - https://gist.github.com/mattregul/748f2f97d0dcae39030a
Comment 3 John Hardman 2016-03-22 10:17:00 UTC
Same problem occurs on UWP with 2.1.0.6529 . As per the original code sample above, word wrap fails even when Grids and ViewCells are not being used.

Can this be given a higher priority/importance please - not being able to see text is pretty fundamental.