Forum Xamarin.Forms

Why does my button text behave differently on each platform?

PoKlPoKl Member ✭✭

currently I'm trying to create a xamarin app for Ios and android, but the button text on each platform behave differently. It shows correctly on android, but on Ios it seems to only show one line of the string.
I would shown you screenshots from the respective devices, but the forum won't let me post links.

I think the problem may the line wrapping on each platform, which I undestand could be solved using custom renderers. I'm not sure how to implement them though.

Here's the constructor where I define my button(however, I don't think my code is the problem). I've tried removing white spaces, as the string comes from a HTML source, and it should be noted that ModulInformation is a subclass of Button.

How do I format the code?(sorry!)

public ModulInformation(string buttonText, double start, double width, double height, DateTime tidspunkt)
this.buttonText = buttonText;
this.start = start;
this.height = height;
this.width = width;
this.tidspunkt = tidspunkt;
CornerRadius = 17;
Text = buttonText.Substring(buttonText.TakeWhile(c => char.IsWhiteSpace(c)).Count());
FontSize = 13;
TextColor = Colors.third;
BackgroundColor = Colors.primary;
FontAttributes = FontAttributes.Bold;



Sign In or Register to comment.