maui-samples
maui-samples copied to clipboard
All of the CollectionView samples need to be updated so the CV is inside a Grid not a StackLayout
https://github.com/dotnet/maui-samples/blob/main/8.0/UserInterface/Views/CollectionViewDemos/CollectionViewDemos/Views/Swipe/VerticalListSwipeContextItemsPage.xaml#L7
StackLayouts will cause the CollectionView to take up infinite space. What this means is that the CV won't be virtualized at all. if a CV has 100 items it'll render 100 items which is really bad for performance
In addition, a CollectionView in a Grid with a LONG enough array must use * rather than Auto.
<Grid RowDefinitions="Auto,50"><!-- it should be * rather than Auto -->
<CollectionView>
<CollectionView.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>Item 1</x:String>
<!-- Provide a long enough array to see the effect! -->
<x:String>Item 30</x:String>
</x:Array>
</CollectionView.ItemsSource>
</CollectionView>
<Button Grid.Row="1"
Text="This is a button" />
</Grid>