我在我的项目中实现了一个转盘,但我实现它的方式并没有给我任何回报,我的代码中出现了一些错误?我忘了任何选择吗?参考Xamarin.Forms.CarouselView已经附加
OBS:我正在开发跨平台
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Hanselman.Portable.Views.PodcastPage" Title="{Binding Title}"
xmlns:controls="clr-namespace:ImageCircle.Forms.Plugin.Abstractions;assembly=ImageCircle.Forms.Plugin.Abstractions"
Icon="{Binding Icon}" IsBusy="{Binding IsBusy}"
xmlns:cv="clr-namespace:Xamarin.Forms;assembly=Xamarin.Forms.CarouselView">
<AbsoluteLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
<StackLayout BackgroundColor="White" VerticalOptions="FillAndExpand">
<cv:CarouselView x:Name="car" HeightRequest="200">
<cv:CarouselView.ItemTemplate>
<DataTemplate>
<StackLayout Orientation="Vertical">
<Image Aspect="AspectFit" Source="{Binding imgs}"/>
</StackLayout>
</DataTemplate>
</cv:CarouselView.ItemTemplate>
</cv:CarouselView>
</AbsoluteLayout>
</ContentPage>
public class Dados
{
public string imgs { get; set; }
}
public PodcastPage()
{
InitializeComponent();
List<Dados> lista = new List<Dados>();
lista.Add(new Dados
{
imgs = "car1.png",
});
lista.Add(new Dados
{
imgs = "car2.png",
});
lista.Add(new Dados
{
imgs = "car3.png",
});
car.ItemsSource = lista;
}
答案 0 :(得分:0)
<cv:CarouselView x:Name="MainCarouselView" HeightRequest="100">
<cv:CarouselView.ItemTemplate>
<DataTemplate>
<Label Text="jose" FontSize="50" TextColor="Black"/>
</DataTemplate>
</cv:CarouselView.ItemTemplate>
</cv:CarouselView>
我尝试没有图片只有里面的标签,并向我显示我的名字,即使这样也没有给我任何东西,但当我删除旋转木马时,它有效,看到我确认我的错误在我的旋转木马,它不是图像问题