Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement Carousel View in Xamarin.forms

Is there any way we can create Carousel View instead of Carousel page so that only portion of the page swipes left or right. Also I want to create this control in the Xamarin Forms and not specific to platform.

If we need to create this custom control in the xamarin.android or xamarin.iOS then what is the real benefits of using the Xamarin.forms where this simple requirements are not getting satisfied.

like image 564
Vimal Patel Avatar asked Aug 28 '15 09:08

Vimal Patel


4 Answers

There's a well documented CarouselView project hosted on github:

https://github.com/chrisriesgo/xamarin-forms-carouselview and http://chrisriesgo.com/xamarin-forms-carousel-view-recipe/

like image 190
Daniel Luberda Avatar answered Sep 20 '22 01:09

Daniel Luberda


The nuget package for the CarouselView is now available (v2.3.0-pre1): https://www.nuget.org/packages/Xamarin.Forms.CarouselView/2.3.0-pre1

like image 43
Alexander Avatar answered Sep 22 '22 01:09

Alexander


We can use the CarouselView which was introduced in Xamarin forms 4.3. Now in Xamarin 4.6, we don't have to use the Forms.SetFlags("CollectionView_Experimental"); in appdelegate of iOS and mainactivity of android.

However, to use the indicatorview for the Carousel page we have to set this Forms.SetFlags("IndicatorView_Experimental"); in appdelegate of iOS and mainactivity of android.

like image 37
George Isaac Avatar answered Sep 22 '22 01:09

George Isaac


I have just implemented a similar thing. To create the a carousel view, I just created a horizontal Stacklayout, wrapped in a horizontal scroll view.

In my particular example, I needed to create an image gallery. I used the Camera control from the Xamarin.Labs project to get the image from either the camera roll or the camera itself. I then added this as a child to the Stacklayout.

Hope this helps.

like image 32
Mike Avatar answered Sep 23 '22 01:09

Mike