Bug 28621 - Wrapping of text on Button controls is inconsistent
Summary: Wrapping of text on Button controls is inconsistent
Status: CONFIRMED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.4.1
Hardware: PC Windows
: Normal enhancement
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-04-01 05:23 UTC by John Hardman
Modified: 2018-07-11 15:08 UTC (History)
18 users (show)

Tags: all visual ac
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 28621 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-04-01 05:23:16 UTC
When the text on a Button view contains more than one line (separated by carriage return\linefeed) or text that does not fit on one line, the result is different on each platform.

On WinPhone, each line is shown, but left-justified. Any line that doesn't fit is clipped.
On Android, each line is shown, but centered. Any line that doesn't fit is automatically wrapped.
On iOS, only the first line is shown. If the first line is long, the font size will be reduced and/or part of the text will be replaced by an ellipsis.

Demonstrated by the following code:

using Xamarin.Forms;

namespace LineWrapIssue
{
    public class App : Application
    {
        public App()
        {
            // The root page of your application
            MainPage = new ContentPage
            {
                Title = "Page Title",
                Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), Device.OnPlatform(0,0,20), 0),
                Content = new StackLayout
                {
                    HorizontalOptions = LayoutOptions.Fill,
                    Orientation = StackOrientation.Vertical,
                    Padding = new Thickness(0, 0, 0, 0),
                    VerticalOptions = LayoutOptions.Fill,
                    Children =
                    {
                        new Button
                        {
                            Text = "Top button - line 1 of 2\r\nTop button - line 2 of 2 is a lot longer than line 1"
                        }
                    }
                }
            };
        }

        protected override void OnStart()
        {
            // Handle when your app starts
        }

        protected override void OnSleep()
        {
            // Handle when your app sleeps
        }

        protected override void OnResume()
        {
            // Handle when your app resumes
        }
    }
}
Comment 2 John Hardman 2015-12-15 20:45:30 UTC
Is there any update on this? It is more than 8 months since this was raised.
Comment 3 maurizio.zucchi 2016-08-10 11:27:34 UTC
Something new in this case?
Comment 4 Thiago Grandesso 2016-08-24 19:38:06 UTC
Facing the same issue here. Any update on it?
Comment 5 ScottRFrost 2017-02-13 15:56:42 UTC
Confirmed as still a problem in Xamarin 4.3.0.664, 7 weeks before this bug's 2 year birthday
Comment 6 Halil Dogan Bolak 2017-04-11 16:25:16 UTC
Still is a problem with Xamarin.Forms 2.3.4.224 - a two year old bug !!
Comment 7 nathan.owski 2017-11-10 10:35:11 UTC
Just found out the bug I just ran in to has been reported 2 and a half year ago.
Please fix it