I am trying to create a custom Action Sheet using CollectionView, but I have a problem with auto resizing the height. When I insert the CollectionView into the page, it takes up all the free space. What needs to be done so that the height of the CollectionView changes depending on the height of its elements?
<?xml version="1.0" encoding="utf-8"?> <StackLayout Margin="60, 0"> <CollectionView BackgroundColor="White" x:Name="CollectionViewControl"> <CollectionView.Header> <Label x:Name="HeaderLabel" TextTransform="Uppercase" HorizontalTextAlignment="Center" FontAttributes="Bold" /> </CollectionView.Header> <CollectionView.ItemTemplate> <DataTemplate> <Grid Padding="0, 10" x:DataType="modalDialogs:ActionSheetItem"> <Grid.ColumnDefinitions> <ColumnDefinition Width="8*" /> <ColumnDefinition Width="2*" /> </Grid.ColumnDefinitions> <Label Text="{Binding Name}" /> <Image Grid.Column="1" Source="arrow_down" IsVisible="{Binding IsSelected}" /> </Grid> </DataTemplate> </CollectionView.ItemTemplate> <CollectionView.Footer> <Button BackgroundColor="Transparent" TextColor="Green" Text="Cancel" HorizontalOptions="End" /> </CollectionView.Footer> </CollectionView> </StackLayout>
https://stackoverflow.com/questions/66993862/how-to-change-collectionview-size-according-sizes-of-its-items April 08, 2021 at 04:44AM
没有评论:
发表评论