Xamarin Forms Carousel View in C#

I'm trying to create a Xamarin Forms app for iOS using a Carousel view but i'm getting no where and I can't seem to find any useful help.
I can use C# and have a fairly good knowledge of C# but I can't seem to find anything useful.
Everythig i'm seeing is using XAML code which i'm not familiar with.

If someone could provide a very simple project of a Carousel page written in C# that would be a massive help
As would anyother information on Carousel pages.

Posts

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    https://developer.xamarin.com/guides/xamarin-forms/user-interface/navigation/carousel-page/

    Materials on CarouselPage (It will be dismissed...)

    codeworks.it/blog/?p=444 Here @CorradoCavalli's blog explain how to use Xamarin Forms CarouselView.

    another CarouselView implementation https://github.com/alexrainman/CarouselView

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    I can use C# and have a fairly good knowledge of C# but I can't seem to find anything useful.
    Everythig i'm seeing is using XAML code which i'm not familiar with.

    My two cents worth - Get up to speed on XAML. Building UI in C# is generally considered bad out in the real world of development. WPF developers have been building UI in XAML for a decade. So any company looking for XAML/Xamarin development would expect you to build your UI in XAML. In the XML editor, not any kind of drag-n-drop.

    That's just the reality of employment expectations, so you might as well jump on board the XAML train now.

  • grantwardlegrantwardle GBMember

    I prefer the whole layout of C#, we layout it out differently, nothing is untidy and there aren't { } at the end of every line.
    I'd prefer to carry on with C# moreso than anything as this is just an interest for me and the code to use is only for me and my friend.
    But I appreciate your help and information!

  • seanydaseanyda GBMember ✭✭✭✭✭
    CarouselView cv = new CarouselView();
    cv.ItemTemplate = GetDataTemplate();
    cv.ItemsSource = graphList;
    

    Graph List will be a list of views. For example images. This is the GetDataTemplate method

    public DataTemplate GetDataTemplate()
            {
                return new DataTemplate(() =>
                {
                    View v = graphList[Count].view;
                    Count++;
                    return v;
                });
            }
    

    Count starts at 0, You should be able to take it from there

  • LoguLogu INUniversity ✭✭

    @Vaka.GopiNadhReddy Instead of Nos is it Possible to add images in your Example?

  • Vaka.GopiNadhReddyVaka.GopiNadhReddy USMember ✭✭✭

    @Logu yeah it's possible to add images in carouselview...........

  • LoguLogu INUniversity ✭✭

    @Vaka.GopiNadhReddy Can you please add some images and send sample. it would be more helpful. Thanks in advance.

  • FrankZFrankZ USMember

    @Logu Maybe the following sample helps with adding images (which are embedded resources here).

    public class PageCarouselView : ContentPage
        {
            public class CarouselItem
            {
                public ImageSource Picture {get; set;}
            }
    
            public PageCarouselView()
            {
                ObservableCollection<CarouselItem> pictures = new ObservableCollection<CarouselItem>();
    
                pictures.Add(new CarouselItem { Picture = ImageSource.FromResource("xxx.yyy1.jpg") });
                pictures.Add(new CarouselItem { Picture = ImageSource.FromResource("xxx.yyy2.jpg") });
                pictures.Add(new CarouselItem { Picture = ImageSource.FromResource("xxx.yyy3.jpg") });
    
                DataTemplate template = new DataTemplate(() =>
                {
                    Image image = new Image();
                    image.SetBinding(Image.SourceProperty,"Picture");
    
                    return image;
                });
    
                CarouselView carouselview = new CarouselView()
                {
                    ItemsSource = pictures,
                    ItemTemplate = template
                };
    
                Content = carouselview;
            }
        }
    
  • AndreiMisiukevich_AndreiMisiukevich_ USMember ✭✭✭✭✭

    Hi) I propose to check this package.
    It's not carousel, but it's something very similar with carousel.

    thx

    https://github.com/AndreiMisiukevich/CardView -- source with sample
    https://www.nuget.org/packages/CardsView -- nuget

Sign In or Register to comment.