首页 > 解决方案 > xaml 图像无法定位到 carouselview 的顶部

问题描述

在我的 Xamarin.Forms 应用程序中,我有一个 CarouselView,里面有图像。我想将图像放置在 Carousel 顶部的 CarouselView 内。我试过了,VerticalOptions="Start"但它不起作用。这是我的轮播 Xaml:

<controls:CarouselViewControl
        x:Name="TeaserCarouselView"
        ShowIndicators="true"
        InterPageSpacing="16"
        CurrentPageIndicatorTintColor="#4A9630"
        IndicatorsTintColor="#8bdc6f"
        HeightRequest="300"
        ItemsSource="{Binding MainTeaserImageUrls}">
        <controls:CarouselViewControl.ItemTemplate>
            <DataTemplate>
                <ffimageloading:CachedImage
                    VerticalOptions="Start"
                    Source="{Binding .}">
                </ffimageloading:CachedImage>
            </DataTemplate>
        </controls:CarouselViewControl.ItemTemplate>
</controls:CarouselViewControl>

图像始终位于 Carousel 的中心。我怎样才能改变这个?

标签: xamluser-interfacemvvmlayoutxamarin.forms

解决方案


我想到了。我只需要将图像放入网格中。ffimageloading上面的代码除了封装内部 a外没有变化<Grid>。现在它工作正常!


推荐阅读