Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] Label inside nested Grid takes too much height #10303

Open
viktorszekeress opened this issue Apr 11, 2020 · 5 comments
Open

[Bug] Label inside nested Grid takes too much height #10303

viktorszekeress opened this issue Apr 11, 2020 · 5 comments
Labels
4.5.0 regression on 4.5.0 a/grid a/label a/layout i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often i/regression p/Android t/bug 🐛
Projects

Comments

@viktorszekeress
Copy link

Description

I have a Label in the Grid. This Grid is then placed in the another Grid:

        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Grid Grid.Column="0">
                <Label BackgroundColor="LightSeaGreen" Text="Abc" />
            </Grid>
            <Grid Grid.Column="1">
                <Label BackgroundColor="Orange" Text="Def" />
            </Grid>
        </Grid>

"Abc" Label takes properly only the height it needs.
But "Def" Label takes 3x of the height it should require.

Steps to Reproduce

  1. Open the attached solution
  2. Observe the wrong label size in different scenarios

Expected Behavior

Label should always take only the size it requires.

Actual Behavior

Label requires 3x more of height.

Basic Information

  • Version with issue: 4.5.0.617
  • Platform Target Frameworks:
    • iOS: not tested
    • Android: yes
    • UWP: not tested

Screenshots

xforms_grid_bug

Reproduction Link

App1_Label_size.zip

Workaround

If it's a simple Grid, same look and behavior can be achieved with StackLayout:

        <StackLayout Orientation="Horizontal">
            <Grid>
                <Label BackgroundColor="LightSeaGreen" Text="Abc" />
            </Grid>
            <Grid HorizontalOptions="FillAndExpand">
                <Label BackgroundColor="Orange" Text="Def" />
            </Grid>
        </StackLayout>
@viktorszekeress viktorszekeress added s/unverified New report that has yet to be verified t/bug 🐛 labels Apr 11, 2020
@pauldipietro pauldipietro added this to New in Triage Apr 11, 2020
@jsuarezruiz jsuarezruiz added i/regression i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often labels Apr 22, 2020
@jsuarezruiz
Copy link
Contributor

This behavior seems incorrect:
label-layout-issue

@jsuarezruiz jsuarezruiz moved this from New to Needs Estimate in Triage Apr 22, 2020
@jsuarezruiz jsuarezruiz removed the s/unverified New report that has yet to be verified label Apr 22, 2020
@samhouts samhouts added the 4.5.0 regression on 4.5.0 label Jun 17, 2020
@samhouts samhouts added this to the 4.5.0 milestone Jun 17, 2020
@samhouts samhouts removed this from the 4.5.0 milestone Jul 8, 2020
@samhouts samhouts added this to the 5.0.0 milestone Aug 13, 2020
@samhouts samhouts added this to To do in vNext+1 (5.0.0) Aug 13, 2020
@samhouts samhouts removed this from the 5.0.0 milestone Nov 2, 2020
@nielscup
Copy link

Same problem here. I encountered this issue twice now in 1 project. In one occasion the row height was too large when the label text was empty. Turned out the row height decreased when the text length increased. I ended up setting a fixed height because auto and * had the same problem.

@kasimier-vireq
Copy link

This is biting us as well.
It is also hindering us from preparing our XF app for a move to MAUI. Because we can't replace our StackLayouts with Grids. And we have to replace those, because we can't use ScrollViews and ListViews inside StackLayouts in MAUI.

@vszekeress-sportradar
Copy link

This a real shame. It's been 2.5 years since I reported the issue. This is a crucial layouting system Microsoft, this must work as expected.

@askariya
Copy link

askariya commented Jun 22, 2023

Any word on a fix for this? I saw someone used ColumnSpacing="0" on any Grids that contain labels like this to work around the issue. That didn't work for me, however.
I'm still seeing it in Xamarin Forms v5.00.2545

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
4.5.0 regression on 4.5.0 a/grid a/label a/layout i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often i/regression p/Android t/bug 🐛
Projects
Triage
  
Needs Estimate
Development

No branches or pull requests

7 participants