Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

Multi-line text on buttons - how to get consistent across platforms?

$
0
0

When the Text property of a Button is set to text that contains more than one line (i.e. has a carriage return/linefeed in the middle), what gets displayed is different on each platform.

On iOS, only the first line is displayed.
On Android, all lines are displayed, but centered.
On Windows Phone, all lines are displayed, but left-justified.

This is easily reproduced, by using the FormsGallery sample and tweaking the code in the ButtonDemoPage as below:

        Button button = new Button
        {
            Text = "This is a short line\r\nThis is a longer second line of text",
            BorderWidth = 1,
            HorizontalOptions = LayoutOptions.Center,
            VerticalOptions = LayoutOptions.CenterAndExpand
        };

Is there any plan to make these behaviours consistent across platforms? If so, is there a timescale for this?
I know that I could write custom renderers to do this, but it seems such a basic thing that consistent behaviour should be built in, that I would expect this to appear in Xamarin.Forms itself at some point.

Thanks,

John H.


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>