繁体   English   中英

carouselview无法以xamarin形式使用

[英]carouselview not working in xamarin forms

在我的xamarin表单项目中,主页上有两个轮播图片旋转木马正在运行,但见证轮播在2天前已停止工作,这是见证xamarin表单项目的代码

.xaml文件代码:

<StackLayout Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="4">
   <Label Text="Testimonials" FontSize="15" TextColor="#3a5370" FontFamily="OpenSansBold.ttf#OpenSansBold" HorizontalTextAlignment="Center"/>
   <forms:CarouselView x:Name="TestimonialSlider">
      <forms:CarouselView.ItemTemplate>
         <DataTemplate>
            <StackLayout Orientation="Vertical" HorizontalOptions="Center">
               <Label Text="{Binding testitext}" HorizontalTextAlignment="Center"/>
               <Label Text="{Binding owner}" HorizontalTextAlignment="Center" FontAttributes="Bold"/>
            </StackLayout>
         </DataTemplate>
      </forms:CarouselView.ItemTemplate>
   </forms:CarouselView>
</StackLayout>

xaml.cs文件代码:

public class testicar
{
    public string testitext { get; set; }
    public string owner { get; set; }
}

List<testicar> testimonial;

public HomePage()
{
    InitializeComponent();

    testimonial = new List<testicar>();

    testimonial.Add(new testicar
    {
        testitext = "hi",
        owner = "how are you ?"
    });

    testimonial.Add(new testicar
    {
        testitext = "hi",
        owner = "how are you ?"
    });

    testimonial.Add(new testicar
    {
        testitext = "hi",
        owner = "how are you ?"
    });

    TestimonialSlider.ItemsSource = testimonial;
}

应该有高度问题。 您的内容与图片重叠。 只是玩高并检查。 应该是可以的

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM