maui icon indicating copy to clipboard operation
maui copied to clipboard

Label WordWrap does not work inside HorziontalStackLayout or StackLayout with horizontal orientation

Open borrmann opened this issue 2 years ago • 4 comments

Description

A Label with LineBreakMode="WordWrap" does not wrap the text when inside a HorizontalStackLayout or StackLayout with Orientation="Horizontal". It works with a VerticalStackLayout.

Steps to Reproduce

  1. Put a Label inside a HorizontalStackLayout
  2. Set LineBreakMode to "WordWrap" and give it a long text
  3. Label doesnt break its text

Link to public reproduction project repository

https://github.com/borrmann/LabelBreak

Version with bug

6.0.486 (current)

Last version that worked well

Unknown/Other

Affected platforms

iOS, Windows

Affected platform versions

iOS 16, Windows 10.0.171340.0

Did you find any workaround?

no

Relevant log output

No response

borrmann avatar Oct 26 '22 09:10 borrmann

Similar or the same as https://github.com/dotnet/maui/issues/10046

jsuarezruiz avatar Oct 26 '22 18:10 jsuarezruiz

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.

ghost avatar Oct 26 '22 18:10 ghost

Having the same issue, no workaround available. Breaking most of the layouts in our app. Please let us know when there is a workaround or a fix.

petrakritzinger avatar Nov 10 '22 07:11 petrakritzinger

@jsuarezruiz when might this get picked up? It is disheartening to see so many layout issues not being resolved in a timely manner.

JohnHDev avatar Nov 26 '22 07:11 JohnHDev

This is expected behavior; horizontal stack layouts do not limit the horizontal space their child controls can consume, so there's no reason for a Label to ever wrap its text.

If you need text to wrap, then you need to use a control which limits the horizontal space (like a Grid) or set a maximum width request on your horizontal layout.

hartez avatar Jan 10 '23 21:01 hartez

@hartez gotcha! However, shouldn't the Width of the HorizontalStackLayout be limited to the Width of its parent, e.g. if we have the HorizontalStackLayout inside a Grid like you suggested?

borrmann avatar Jan 10 '23 23:01 borrmann

@hartez gotcha! However, shouldn't the Width of the HorizontalStackLayout be limited to the Width of its parent, e.g. if we have the HorizontalStackLayout inside a Grid like you suggested?

No. Stacking layouts just keep stacking in their unconstrained direction until they run out of things to stack.

hartez avatar Jan 12 '23 18:01 hartez

Not sure if this helps, but I had the same issue with word wrap not working. This was in a Grid cell, where the column definition width was set to "Auto". Changing to "*" it then wrapped without using LineBreakMode="WordWrap". Also I am using TextType="Html"

BrianJSavage avatar Feb 10 '23 02:02 BrianJSavage