在 xamarin forms 4.4.0 中将图像添加到轮播视图
add images to carousel view in xamarin forms 4.4.0
我有创建轮播视图的代码
<CarouselView x:Name="TheCarousel">
<CarouselView.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>Hey...</x:String>
<x:String>Psssst...!</x:String>
<x:String>Did you check out...</x:String>
<x:String>The awesome new CarouselView</x:String>
<x:String>In Xamarin.Forms 4.4?!</x:String>
<x:String> </x:String>
</x:Array>
</CarouselView.ItemsSource>
<CarouselView.ItemTemplate>
<DataTemplate>
<StackLayout HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand">
<Label Text="{Binding .}" HorizontalTextAlignment="Center" FontSize="Title" />
</StackLayout>
</DataTemplate>
</CarouselView.ItemTemplate>
</CarouselView>`
我如何使用图片而不是字符串来查看,
我在 visual studio 2019
使用 xamarin 4.3.0
在模板中使用 Image
而不是 Label
<CarouselView x:Name="TheCarousel">
<CarouselView.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>[image url goes here]</x:String>
<x:String>[image url goes here]</x:String>
<x:String>[image url goes here]</x:String>
</x:Array>
</CarouselView.ItemsSource>
<CarouselView.ItemTemplate>
<DataTemplate>
<StackLayout HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand">
<Image Source="{Binding .}" />
</StackLayout>
</DataTemplate>
</CarouselView.ItemTemplate>
</CarouselView>`
我有创建轮播视图的代码
<CarouselView x:Name="TheCarousel">
<CarouselView.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>Hey...</x:String>
<x:String>Psssst...!</x:String>
<x:String>Did you check out...</x:String>
<x:String>The awesome new CarouselView</x:String>
<x:String>In Xamarin.Forms 4.4?!</x:String>
<x:String> </x:String>
</x:Array>
</CarouselView.ItemsSource>
<CarouselView.ItemTemplate>
<DataTemplate>
<StackLayout HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand">
<Label Text="{Binding .}" HorizontalTextAlignment="Center" FontSize="Title" />
</StackLayout>
</DataTemplate>
</CarouselView.ItemTemplate>
</CarouselView>`
我如何使用图片而不是字符串来查看, 我在 visual studio 2019
使用 xamarin 4.3.0在模板中使用 Image
而不是 Label
<CarouselView x:Name="TheCarousel">
<CarouselView.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>[image url goes here]</x:String>
<x:String>[image url goes here]</x:String>
<x:String>[image url goes here]</x:String>
</x:Array>
</CarouselView.ItemsSource>
<CarouselView.ItemTemplate>
<DataTemplate>
<StackLayout HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand">
<Image Source="{Binding .}" />
</StackLayout>
</DataTemplate>
</CarouselView.ItemTemplate>
</CarouselView>`