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

Unconstrained * rows/columns in Grid may expand when they should not #14694

Closed
hartez opened this issue Apr 20, 2023 · 1 comment · Fixed by #14902
Closed

Unconstrained * rows/columns in Grid may expand when they should not #14694

hartez opened this issue Apr 20, 2023 · 1 comment · Fixed by #14902
Assignees
Labels
area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter fixed-in-7.0.92 Look for this fix in 7.0.92! fixed-in-7.0.100 fixed-in-7.0.101 fixed-in-8.0.0-preview.5.8529 Look for this fix in 8.0.0-preview.5.8529! layout-grid t/bug Something isn't working

Comments

@hartez
Copy link
Contributor

hartez commented Apr 20, 2023

Given the following structure:

<VerticalStackLayout>
  <Grid RowDefinitions="*,*,*">
    <Label Text="Item 1" HeightRequest="35"/>
    <Label Text="Item 2" Grid.Row="1" HeightRequest="200"/>
    <Label Text="Item 3" Grid.Row="2" />
  </Grid>
</VerticalStackLayout>

Because the Grid is unconstrained vertically, the * rows should act as if they were Auto rows. Which means that the first row should have the height of the content (the 35 from the first Label). However, in some situations the logic which determines whether the * rows should expand to have matching size values will be triggered erroneously, and the rows will be expanded to consume the entire space with equal distribution. This happens when the cross-platform layout compares its measured size with the native platform's measurements and differences in architecture/rounding result in slightly different values.

We need to account for the rounding differences to avoid expanding these values erroneously. Possibly by introducing a tolerance value. Also, we need to determine whether decompression of * values should ever happen when the Grid is unconstrained in that direction; if not, then we can also avoid this situation by checking the initial measurement constraints when deciding whether to decompress the *'s.

@AmrAlSayed0
Copy link
Contributor

I feel that with unconstrained Grids, star rows should take on the size of the largest star. For example, in the case you mentioned all rows would have a height of 200 since this still preserves the behavior of star rows/columns have set ratios between their lengths. In this case it's 1 but it could be anything.

@github-project-automation github-project-automation bot moved this from In Progress to Done in MAUI SDK Ongoing May 16, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Jun 15, 2023
@samhouts samhouts added the fixed-in-8.0.0-preview.5.8529 Look for this fix in 8.0.0-preview.5.8529! label Jun 21, 2023
@samhouts samhouts added this to the .NET 7 + Servicing milestone Jul 10, 2023
@samhouts samhouts added the fixed-in-7.0.92 Look for this fix in 7.0.92! label Jul 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter fixed-in-7.0.92 Look for this fix in 7.0.92! fixed-in-7.0.100 fixed-in-7.0.101 fixed-in-8.0.0-preview.5.8529 Look for this fix in 8.0.0-preview.5.8529! layout-grid t/bug Something isn't working
Projects
None yet
4 participants