简体   繁体   English

Xamarin - CollectionView 第一项和最后一项的额外空间

[英]Xamarin - CollectionView extra space for first and last item

Hello guys,大家好,

my question is if I'am able to add some extra space above first item and under last item in CollectionView in Xamarin.我的问题是我是否能够在 Xamarin 的 CollectionView 中的第一项上方和最后一项下方添加一些额外的空间。

I have items styled like card with rounded corners but at the moment it can't be seen clearly because there is no space above first and under last item.我有类似圆角卡片的物品,但目前看不清楚,因为第一个物品上方和最后一个物品下方没有空间。 Vertical space between them is okay with ItemSpacing property.它们之间的垂直空间可以使用 ItemSpacing 属性。

I will add screenshot here.我将在此处添加屏幕截图。 The blackline is the exact place where I need space.黑线是我需要空间的确切位置。

As jason said that you can add padding or Margin for Grid or stacklayout, then add CollectionView in this layout.正如 jason 所说,您可以为 Grid 或 stacklayout 添加 padding 或 Margin,然后在此布局中添加 CollectionView。

 <Grid Padding="20">
            <CollectionView ItemsSource="{Binding images}">
                <CollectionView.ItemTemplate>
                    <DataTemplate>
                        <Frame BorderColor="Black" CornerRadius="30">
                            <StackLayout>
                                <Image Source="{Binding imagepath}" />
                                <Label Text="{Binding text}" />
                            </StackLayout>
                        </Frame>
                    </DataTemplate>
                </CollectionView.ItemTemplate>
            </CollectionView>
        </Grid>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ListView 和 CollectionView 占用的空间超过 Xamarin Forms 中所需的空间 - ListView and CollectionView are taking extra space than the required space in Xamarin Forms Xamarin.CommunityToolkit.MauiCompat TouchEffect 未应用于 CollectionView 的第一项 - Xamarin.CommunityToolkit.MauiCompat TouchEffect is not applied to the first item of the CollectionView 当我尝试在 Xamarin Forms - Only the first item in a list is rendered when I try to output a collectionview inside a collectionview in Xamarin Forms 如何从每个 CollectionView 项目中获取 Xamarin? - How to get Xamarin form each CollectionView item? Xamarin CollectionView 与 HorizontalItemSpacing 相等的项目宽度 - Xamarin CollectionView equal item width with HorizontalItemSpacing 获取 Tapped collectionview 项的索引 xamarin - Getting Index of Tapped collectionview item xamarin 我可以绑定到CollectionView的第一项吗? - Can I bind to the first item of a CollectionView? 删除 xamarin 表单布局中的额外空间 - remove extra space in xamarin forms layout Xamarin.Forms ScrollView 添加额外空间 - Xamarin.Forms ScrollView adds extra space 根据是否选择了 Xamarin CollectionView 项来确定 ReactiveUI 中的 CanExecute - Determining CanExecute in ReactiveUI based upon whether a Xamarin CollectionView item is selected
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM