简体   繁体   English

轮播视图不返回任何内容

[英]Carousel view does not return anything

I'm implementing a carrousel in my project, but the way I'm implementing it is not returning me anything, to some error in my code? 我正在项目中实现旋转木马,但是实现它的方式没有使我返回任何东西,代码中出现了一些错误? Am I forgetting any options? 我会忘记任何选择吗? Reference Xamarin.Forms.CarouselView is already attached 参考Xamarin.Forms.CarouselView已附加

OBS: I am developing crossplataform 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;
    }
    <cv:CarouselView x:Name="MainCarouselView" HeightRequest="100">
            <cv:CarouselView.ItemTemplate>
                <DataTemplate>
                    <Label Text="jose" FontSize="50" TextColor="Black"/>
                </DataTemplate>
            </cv:CarouselView.ItemTemplate>
        </cv:CarouselView>

I tried without image only with the label inside and showing me my name, even so it does not return anything to me, but when I remove the carousel it works, seeing that I verified that my error is in my carousel, it is not an image question 我尝试了仅带标签的图像,但没有显示任何图像,即使它不会向我返回任何内容,但是当我移除轮播时,它可以正常工作,并看到我验证了自己的错误是在轮播中,而不是形象问题

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

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