Repository navigation
Description
Current behavior
Grids set their actual size incorrectly with respect to child elements with margins. We use the following code in ContentDialog to force the content to take up as much room as possible, up to a desired max width/height:
<ContentDialog
x:Class="Volt.Views.Tracking.SelectLocationDialog"
...>
<Grid CornerRadius="8" MaxWidth="600" MaxHeight="600">
<!-- Forces the grid to try to stretch to the max width and height above if the room is available,
but the actual grid width/height should not exceed the available width/height in the
content dialog -->
<Rectangle x:Name="PushRect" Width="600" Margin="0,0,0,9999"/>
<maps:MapControl x:Name="MapView" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
</Grid>
</ContentDialog>This works fine in WinUI, but in Uno the grid's actual height gets set to 9999 instead of filling the available height in the content dialog, which means that in the example above, the map height now stretches to 9999 as well instead of the available height in the content dialog.
This is how it should behave:
Recording.2024-10-28.122051.mp4
Expected behavior
The bottom 9999 margin of PushRect should not cause the grid's actual size to go beyond the available height in the grid's parent container.
How to reproduce it (as minimally and precisely as possible)
No response
Workaround
No response
Works on UWP/WinUI
Yes
Environment
Uno.WinUI / Uno.WinUI.WebAssembly / Uno.WinUI.Skia
NuGet package version(s)
5.4.10
Affected platforms
WebAssembly, Android, iOS, Mac Catalyst, Skia (WPF), Skia (Linux X11), Skia (macOS), Skia (Linux Framebuffer), Skia (GTK), Windows (WinAppSDK)
IDE
No response
IDE version
No response
Relevant plugins
No response
Anything else we need to know?
No response
Activity
[-]Grid sizing bug[/-][+]Grid calculated actual size bug (child element margins not used correctly)[/+]