Skip to content
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

Labels in VerticalStackLayout in a CollectionView without a WidthRequest is not wrapping according to the LineBreakMode #8873

Open
KlausKurzawa opened this issue Jul 21, 2022 · 7 comments
Labels
area-controls-label Label, Span area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter delighter layout-stack migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert p/2 Work that is important, but is currently not scheduled for release platform/android 🤖 platform/iOS 🍎 platform/windows 🪟 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@KlausKurzawa
Copy link

KlausKurzawa commented Jul 21, 2022

Description

I have a HorizontalStackLayout with an image and a VerticalStackLayout containing a Label to hold my Subject. If I use a smaller device I would the Subject to be wrapped accoording to the width of the device and the Labels LineBreakMode. But this is not happend.

If I manually set the width of the VerticalStackLayout the Subject is wrapped but I want this to be automaticly done.

What have I missed or done wrong?

Using VS 2022 v17.3.0 Preview 4.0
dotnet --version: 6.0.400-preview.22330.6

Steps to Reproduce

  1. In James Montemagno's 'Learn .NET MAUI - Full Course for Beginners' check out the Part2-solution code on Github.
  2. I opened the solution for Part 2 and made the Name of the Capuchin Monkey longer; Name="Capuchin Monkey with dark head" then the LineBreakMode does not wrap the text.
  3. On line#33 in MainPage.xaml I just chnaged to:
    If I set the WidthRequest to i.e "275" it works but devices can have different widths.

Workaround is to set a WidthRequest and the wrapping works but it is not how it should work.

I also described this in a code of my own;
https://stackoverflow.com/questions/73036703/net-maui-labels-in-verticalstacklayout-in-a-collectionview-not-wrapping-accordi

Version with bug

6.0.400

Last version that worked well

Unknown/Other

Affected platforms

Android, Windows

Affected platform versions

VS 2022 v17.3.0 Preview 4.0,

Did you find any workaround?

If I set the WidthRequest to i.e "275" it works but devices can have different widths.

Relevant log output

No response

@KlausKurzawa KlausKurzawa added s/needs-verification Indicates that this issue needs initial verification before further triage will happen t/bug Something isn't working labels Jul 21, 2022
@Eilon Eilon added the area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter label Jul 21, 2022
@rmarinho rmarinho added p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint platform/iOS 🍎 platform/android 🤖 platform/windows 🪟 legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor area-controls-label Label, Span and removed s/needs-verification Indicates that this issue needs initial verification before further triage will happen labels Jul 22, 2022
@KlausKurzawa
Copy link
Author

This error still exists in the released product VS 2022 v17.3.0 or is it by design?
If so, how can you get the label to automatically truncated on smaller screens?

@NonameMissingNo
Copy link

As a workaround, in code you can get the width of the display, and set MaxWidthRequest there.

@enisn
Copy link

enisn commented Oct 22, 2022

Exactly same situation I faced.

When I use regular Label word wrap is working but when I put it into a StackLayout, wordwrap doesn't work.

 <ScrollView>
        <StackLayout Padding="25" Spacing="15">
            <Label LineBreakMode="WordWrap" Text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book."/>
            
            <HorizontalStackLayout>
                <ImageButton Source="{FontImageSource FontFamily=MaterialRound, Glyph={x:Static m:MaterialRound.Wallpaper}, Color={StaticResource Primary}}" />
                <Label LineBreakMode="WordWrap" Text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book."/>
            </HorizontalStackLayout>
    </StackLayout>
</ScrollView>

image


If I set MaximumWidthRequest for the label, it works as expected but I can't know the exact width for each situation.

<HorizontalStackLayout>
    <ImageButton Source="{FontImageSource FontFamily=MaterialRound, Glyph={x:Static m:MaterialRound.Wallpaper}, Color={StaticResource Primary}}" />
    <Label MaximumWidthRequest="300" LineBreakMode="WordWrap" Text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book."/>
</HorizontalStackLayout>

image

@mattleibow mattleibow added this to the Backlog milestone Nov 10, 2022
@ghost
Copy link

ghost commented Nov 10, 2022

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.

@Zhanglirong-Winnie
Copy link

Verified this issue with Visual Studio Enterprise 17.7.0 Preview 5.0. Can repro on android platform with sample code.
Screenshot 2023-07-31 113530

@nicop85
Copy link

nicop85 commented Aug 17, 2023

Verified this issue with Visual Studio 17.7.0 + Net Maui 8.0.0-preview.6.8686.
Still present for Android and WinUI.

@CodeExplorer321
Copy link

Label or Editor not wrapping when put inside the Grid in Collectionview

@samhouts samhouts modified the milestones: Under Consideration, .NET 8 SR3 Oct 9, 2023
@Redth Redth modified the milestones: .NET 8 SR3, .NET 8 + Servicing Jan 10, 2024
@Eilon Eilon removed the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label May 10, 2024
@PureWeen PureWeen added p/2 Work that is important, but is currently not scheduled for release and removed p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint labels Jul 2, 2024
@PureWeen PureWeen modified the milestones: .NET 8 + Servicing, Backlog Aug 2, 2024
@samhouts samhouts added delighter migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert labels Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-label Label, Span area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter delighter layout-stack migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert p/2 Work that is important, but is currently not scheduled for release platform/android 🤖 platform/iOS 🍎 platform/windows 🪟 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests