Reputation: 141
The MainPage of a simple .Net MAUI App contains a Grid with 4 Rows, all with the same height (*). They contain: Label, CollectionView, Button, Label On Windows and Android the page is shown correct. But on iPhone/iPad the CollectionView is much too high. It covers the Button and Label below (or it pushes them outside the screen)
When using a fix value for Grid.Row=1 the issue does not happen
Visual Studio 2022, Version 17.6.1 .Net 7.0
Reproduce:
<Grid BackgroundColor="LightGray" RowDefinitions="*,*,*,*">
<Label Margin="10" FontSize="30" Text="Header" />
<CollectionView Grid.Row="1" Margin="10" BackgroundColor="LightBlue">
</CollectionView>
<Button
Grid.Row="2" Margin="10" BackgroundColor="Grey"
FontSize="40" Text="Button" />
<Label
Grid.Row="3" Margin="10" BackgroundColor="Coral"
FontSize="40" Text="Footer" />
</Grid>
Upvotes: 2
Views: 1445
Reputation: 10078
This is a known issue reported at GitHub - Make CollectionView on iOS measure to content size #14951 and [iOS] Application stucks on iOS with combination of ScrollView, StackLayout, Editor and CollectionView #14955, please follow the progress at GitHub.
As descripted in the first merged thread, to fix the issue, PG team need modify the CollectionView
on iOS to use its ContentSize
as the value for GetDesiredSize
; this forces the CollectionView
to size to its content rather than attempting to fill the whole screen. So we may need for the next release of .net to get it fixed.
You can also try to use the .NET Upgrade Assistant to upgrade to .NET 8 as an alternative workaround. For more information, you can refer to Announcing a new version of the .NET Upgrade Assistant with support for .NET MAUI.
Upvotes: 2