maui-samples icon indicating copy to clipboard operation
maui-samples copied to clipboard

All of the CollectionView samples need to be updated so the CV is inside a Grid not a StackLayout

Open PureWeen opened this issue 1 year ago • 1 comments

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

PureWeen avatar May 03 '24 23:05 PureWeen

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>

suugbut avatar Dec 29 '24 10:12 suugbut