-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Description
the label control doesn't render the text correctly, in this case I'm using vertical and horizontal stacklayouts but due to #10494 it seems that it has issues in Grid Layout too, so the Label control is a complete messed up in Maui, because it worked perfectly fine in Xamarin.Forms without specifying any LineBreakMode or LineHeight and MaxLine properties.
so the problem is when the text of a label is too long, the text goes outside of it's parent (Layout) and also outside of the screen and doesn't respect setting of any LineBreakMode or LineHeight and MaxLine properties. no matter what, it wont render the text as a multiline label it shows just a single line label, let me show some code and screenshot:
Case #1:
<VerticalStackLayout Margin="10" BackgroundColor="Orange">
<Label Text="Case #1:" />
<HorizontalStackLayout Spacing="10">
<Label Text="TTT" />
<Label
BackgroundColor="Cyan"
HorizontalOptions="FillAndExpand"
LineBreakMode="WordWrap"
LineHeight="1"
MaxLines="3"
Text="x{Binding Notes}xxxxxxxx OO xxxxxxxxxxxHHHHH xxxxxxxxxxxx xxxxxxxxxxxxx xxxxxx xxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxxx xxxxxx 333333333333333333333" />
</HorizontalStackLayout>
</VerticalStackLayout>
which results as the below picture:
but interestingly when you set the WidthRequest of Label, it seems that it works but it's not practical because when you use a horizontal stacklayout you just dont want to set the children's Width manually, you just want the children to fill their container.
so for Case #2:
<VerticalStackLayout Margin="10" BackgroundColor="Orange">
<Label Text="Case #2: With Setting WidthRequest" />
<HorizontalStackLayout Spacing="10">
<Label Text="TTT" />
<Label
BackgroundColor="Cyan"
HorizontalOptions="FillAndExpand"
LineBreakMode="WordWrap"
LineHeight="1"
MaxLines="3"
Text="x{Binding Notes}xxxxxxxx OO xxxxxxxxxxxHHHHH xxxxxxxxxxxx xxxxxxxxxxxxx xxxxxx xxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxxx xxxxxx 333333333333333333333"
WidthRequest="300" />
</HorizontalStackLayout>
</VerticalStackLayout>
Steps to Reproduce
I modified the sample project of #10494 and added these two Cases, and i attach the sample project, please just run the project and see the results
LabelBug.zip
Link to public reproduction project repository
No response
Version with bug
7.0.96
Is this a regression from previous behavior?
Yes, this used to work in Xamarin.Forms
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android 8.0 and 12.0
Did you find any workaround?
No response
Relevant log output
No response

