unoplatform / uno

Open-source platform for building cross-platform native Mobile, Web, Desktop and Embedded apps quickly. Create rich, C#/XAML, single-codebase apps from any IDE. Hot Reload included! 90m+ NuGet Downloads!!
https://platform.uno
Apache License 2.0
8.87k stars 716 forks source link

ItemsRepeater don't give enough space for large text #12881

Closed Marc-Antoine-Soucy closed 1 year ago

Marc-Antoine-Soucy commented 1 year ago

Current behavior

On Uno platforms, the text is not given enough vertical space if the text is too long/ there are other objects in the grid. The example provided is very simplified. image

Expected behavior

It should be like on windows where the ItemRepeater will always give enough vertical space to show all the text image

How to reproduce it (as minimally and precisely as possible)

<Page.Resources>
        <DataTemplate x:Key="SomeTemplate">
            <Grid>
                <TextBlock FontSize="15"
                           Text="aaaaaaa bbbbb ccccccc ddddddddd eeeeeeeeee ffffffffff gggggggggggg  hhhhhhhhhhhh iiiiiiiiiii jjjjjjj kkkkkkk lllllllllll mmmmmmmmmmm nnnnnnn oooooo ppppppp qqqqqq rrrrrrr ssssss"
                           TextWrapping="Wrap" />
            </Grid>
        </DataTemplate>
    </Page.Resources>

    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <muxc:ItemsRepeater ItemTemplate="{StaticResource SomeTemplate}"
                            ItemsSource="{Binding ints}">
            <muxc:ItemsRepeater.Layout>
                <muxc:UniformGridLayout ItemsStretch="Fill"
                                        MaximumRowsOrColumns="2"
                                        MinColumnSpacing="10"
                                        MinItemWidth="130"
                                        MinRowSpacing="10" />
            </muxc:ItemsRepeater.Layout>
        </muxc:ItemsRepeater>
    </Grid>

BasicApp.zip

Workaround

You can set the height of the Item above the text.

Works on UWP/WinUI

Yes

Environment

Uno.WinUI / Uno.WinUI.WebAssembly / Uno.WinUI.Skia

NuGet package version(s)

<PackageReference Include="Uno.Resizetizer" Version="1.2.0-dev.19" />
        <PackageReference Include="Microsoft.Windows.Compatibility" Version="7.0.0" />
        <PackageReference Include="Uno.Toolkit.WinUI" Version="4.0.0-dev.39" />
        <PackageReference Include="Uno.Wasm.Bootstrap" Version="8.0.0-dev.226" />
        <PackageReference Include="Uno.Wasm.Bootstrap.DevServer" Version="8.0.0-dev.226" />
        <PackageReference Include="Uno.WinUI.WebAssembly" Version="5.0.0-dev.1380" />
        <PackageReference Include="Uno.WinUI.RemoteControl" Version="5.0.0-dev.1380" Condition="'$(Configuration)'=='Debug'" />
        <PackageReference Include="Uno.UI.Adapter.Microsoft.Extensions.Logging" Version="5.0.0-dev.1380" />
        <PackageReference Include="CommunityToolkit.Mvvm" Version="8.1.0" />

Affected platforms

WebAssembly, Android, iOS, Skia (GTK on Linux/macOS/Windows)

IDE

Visual Studio 2022

IDE version

Version 17.6.0

Relevant plugins

No response

Anything else we need to know?

No response

agneszitte commented 1 year ago

cc @jeromelaban, @dr1rrb