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

MAUI Android ListView using ViewCell with cells with borders does not appear to wrap text when Label has LineBreakMode="WordWrap" #25219

Open
samhouts opened this issue Oct 11, 2024 · 0 comments
Labels
area-controls-label Label, Span area-controls-listview ListView and TableView area-drawing Shapes, Borders, Shadows, Graphics, BoxView, custom drawing partner/cat 😻 this is an issue that impacts one of our partners or a customer our advisory team is engaged with t/bug Something isn't working

Comments

@samhouts
Copy link
Member

Affected Branch:
Affected Build: packages\microsoft.maui.controls\8.0.72\
Affected Product Language: C#

Steps to reproduce:

1.Given this XAML:
            <ListView ItemsSource="{Binding Items}" SelectionMode="None">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <Border Margin="0" Padding="8" StrokeThickness="5" Stroke="GreenYellow">
                                <Grid RowDefinitions="*">
                                    <Grid ColumnDefinitions="1*,3*">
                                        <Label Text="Brand" />
                                        <Label Grid.Column="1" Text="even longer text more text more text, and even longer text more text more text" LineBreakMode="WordWrap"/>
                                    </Grid>
                                </Grid>
                            </Border>
                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>

Wordwrap appears to not work, and in fact, it looks like the height of the cell is calculated incorrectly such that it hides the text below the top line before wordwrapping.

A viable workaround involves using a CollectionView as shown below:

     <CollectionView ItemsSource="{Binding Items}" SelectionMode="None">
         <CollectionView.ItemTemplate>
             <DataTemplate>
                 <ContentView>
                     <Border Margin="0" Padding="8" StrokeThickness="5" Stroke="GreenYellow">
                         <Grid RowDefinitions="*">
                             <Grid ColumnDefinitions="1*,3*">
                                 <Label Text="Brand" />
                                 <Label Grid.Column="1" Text="even longer text more text more text, and even longer text more text more text" LineBreakMode="WordWrap"/>
                             </Grid>
                         </Grid>
                     </Border>
                 </ContentView>
             </DataTemplate>
         </CollectionView.ItemTemplate>
     </CollectionView>

Full example linked with bug.
:

View on AzDO

@dotnet-policy-service dotnet-policy-service bot added the s/triaged Issue has been reviewed label Oct 11, 2024
@samhouts samhouts added partner/cat 😻 this is an issue that impacts one of our partners or a customer our advisory team is engaged with t/bug Something isn't working area-drawing Shapes, Borders, Shadows, Graphics, BoxView, custom drawing area-controls-listview ListView and TableView area-controls-label Label, Span and removed s/triaged Issue has been reviewed labels Oct 11, 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-controls-listview ListView and TableView area-drawing Shapes, Borders, Shadows, Graphics, BoxView, custom drawing partner/cat 😻 this is an issue that impacts one of our partners or a customer our advisory team is engaged with t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant