dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
21.86k stars 1.68k forks source link

FlexLayout.Grow="1" text cuts off instead of line break on Windows #22371

Open sknochen opened 2 months ago

sknochen commented 2 months ago

Description

If a FlexLayout, containing multiple items with Grow set to "1" and including texts of varying lengths (such as Labels and Buttons), is added to a page, the text may get cut off when multiple items are in the same row. On Android (normal and Samsung DeX) and iOS this bug does not occur.

grafik

If there is only one item in a Row, the text will break over multiple lines as expected:

grafik

Steps to Reproduce

  1. Create a new MAUI app
  2. Add the xaml code below to the page
  3. Start app on Windows
  4. Change the width of the window to see different occurences

Expected The text of the Labels and Buttons breaks over multiple lines

Actual The text of the Labels and Buttons gets cut off

<FlexLayout Wrap="Wrap">
    <VerticalStackLayout Spacing="8" FlexLayout.Grow="1">
        <Label Text="This is a long looong looooong Text, please don't cut me off" LineBreakMode="CharacterWrap" />
        <Label Text="Short Text" />
    </VerticalStackLayout>
    <VerticalStackLayout Spacing="8"  FlexLayout.Grow="1">
        <Label Text="Short Text" />
        <Label Text="Short Text" />
    </VerticalStackLayout>
    <VerticalStackLayout Spacing="8" FlexLayout.Grow="1">
        <Label Text="Short Text" />
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <Label Text="Look at my right neighbor" />
            <Button Grid.Column="1" Text="I am the neighbor" />
        </Grid>
    </VerticalStackLayout>
    <VerticalStackLayout Spacing="8" FlexLayout.Grow="1">
        <Label Text="Short Text" />
        <Label Text="Short Text" />
    </VerticalStackLayout>        
    <VerticalStackLayout Spacing="8" FlexLayout.Grow="1">
        <Label Text="Short Text" />
        <Button Text="This is a long looong looooong looooooong loooooooooong loooooooooooong Text" />
    </VerticalStackLayout>
</FlexLayout>

Link to public reproduction project repository

No response

Version with bug

8.0.21 SR4.1

Is this a regression from previous behavior?

No, this is something new

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

Windows SDK 10.22621.0

Did you find any workaround?

No response

Relevant log output

No response

github-actions[bot] commented 2 months ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

RoiChen001 commented 2 months ago

Can repro this issue at Windows platform on the latest 17.10 Preview 7(8.0.20&8.0.21).