Xamarin旋转木马视图

时间:2017-12-21 22:46:22

标签: c# ios xamarin

我正在尝试使用alexrainman Carousel控件: https://github.com/alexrainman/CarouselView

我无法让它发挥作用

这是我的XAML:

<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" 
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:controls="clr-namespace:CarouselView.FormsPlugin.Abstractions;assembly=CarouselView.FormsPlugin.Abstractions"
    x:Class="QueryPoint.Views.ImageViewer">
    <ContentPage.Content>
        <StackLayout>
          <controls:CarouselViewControl x:Name="carImages" Orientation="Horizontal">
            <controls:CarouselViewControl.ItemTemplate>
              <DataTemplate>
                <Image Source="{Binding Url}" />
              </DataTemplate>
            </controls:CarouselViewControl.ItemTemplate>
          </controls:CarouselViewControl>
        </StackLayout>
    </ContentPage.Content>
</ContentPage>

这是我的.cs文件:

public partial class ImageViewer:ContentPage {     ObservableCollection ListImages;

public ImageViewer()
{
    InitializeComponent();
    carImages.ItemsSource = null;
}

public ImageViewer(List<ImageEntity> list)
{
    InitializeComponent();
    carImages.Position = 0;
    ListImages = new ObservableCollection<ImageEntity>();
    foreach (ImageEntity img in list)
        ListImages.Add(img);
    carImages.ItemsSource = ListImages;

}    

班级是:

public class ImageEntity
{
    public string Url { get; set; }
}

我没有收到错误,但它没有显示任何内容。

不确定我做错了什么。

由于

0 个答案:

没有答案