UI, Xamarin

A simple way to create a carousel in Xamarin Forms

Normally we can see screens in applications with components with swipe behavior within the same page. With CarouselPage we can create this. Let’s see!

What is a CarouselPage?

It’s a type of page with slides interaction in the same screen that we can swipe one by one, you can add images , labels and whatever virtual component that you need inside there. We can create it from the XAML file as well as from the C# file.

Let’s explain CarouselPage structure

➖CarouselPage Is the tag page  that handles the behavior of swipe slides in the page.

➖ContentPage This is a page that just display a single View. You must add as much ContentPage as you want to swipe on you carrousel.

⚠ NoteCarrousel must be populated with ContentPage instances or with ContentPage derivades.

Let’s see an example:

Also you must inherit the ContentPage class in your .cs page source. In this example: CarouselSamplePage.cs

And how can I create a Carousel in C#?

You just have to add as much ContentPage as you need in you .cs source:

And add the ContentPages with the Children property:

📔 If you have the necessity to add a slide in your carousel mixed XAML and C# way, you can do it without any problem.

Spanish post:




Tagged , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *