-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Button only displays first line of multiline text #9949
Comments
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
Might be related to #7618 |
Here's a quick and dirty workaround for the interim. Since MAUI buttons can't have direct content, just put the button in a grid and a label over the top of it. Presses/clicks aren't consumed by the label and work on the button. It's not ideal, but it works.
From StaticResources for the label style:
|
In .NET MAUI, Button now has a If you add |
Confirmed. The Thanks! |
Description
When trying to set the
Text
property of a Button to a string that contains line feed (\n) characters, only the text before the first one will be shown in the Button. In Xamarin.Forms, the Button was able to display multiline strings.Button displaying
"Line\nbreak\ntext"
in MAUI on Android, first Button has noHeightRequest
and second Button has an explicitHeightRequest
of 100:The expected behavior would be the same as in Xamarin.Forms, that being that the Button tries to display as much of the multiline text horizontally and vertically centered as the Buttons size allows.
Button displaying
"Line\nbreak\ntext"
in Xamarin.Forms, first Button has noHeightRequest
and second Button has an explicitHeightRequest
of 100:On Windows, the Button behaves as expected and even requests more height if the text doesn't fit.
Button displaying
"Line\nbreak\ntext\nlets\ncontinue\nthis\nsome\nmore"
in MAUI on Windows, first Button has noHeightRequest
and second Button has an explicitHeightRequest
of 100:Steps to Reproduce
Try to set a string containing Environment.NewLine or \n as text for a Button on Android
Link to public reproduction project repository
https://github.com/KPHIBYE/ButtonMultilineDemo
Version with bug
6.0.486 (current)
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android 5 and up
Did you find any workaround?
No
Relevant log output
No response
The text was updated successfully, but these errors were encountered: