How to bind the selected index in .NET MAUI Carousel?
This section explores how to bind the selected index in a .NET MAUI Carousel. The SelectedIndex property in the Carousel control allows us to bring a particular item to the center of the screen.
XAML:
<ContentPage.Content>
<carousel:SfCarousel
x:Name="carousel"
ItemHeight="300"
ItemWidth="200"
SelectedIndex="2"
ItemsSource="{Binding ImageCollection}"/>
</ContentPage.Content>
C#:
SfCarousel carousel = new SfCarousel()
{
ItemWidth = 200,
ItemHeight = 300,
SelectedIndex = 4,
};
carousel.SetBinding(SfCarousel.ItemsSourceProperty, "ImageCollection");
Output:
Conclusion
I hope you enjoyed learning how to bind the selected index in .NET MAUI Carousel.
You can refer to our .NET MAUI Carousel feature tour page to learn about its other groundbreaking feature representations. You can explore our .NET MAUI Carousel documentation to understand how to present and manipulate data.
For current customers, check out our .NET MAUI components on the License and Downloads page. If you are new to Syncfusion, try our 30-day free trial to explore our .NET MAUI Carousel and other .NET MAUI components.
Please let us know in the following comments section if you have any queries or require clarifications. You can also contact us through our support forums, Direct-Trac, or feedback portal, or the feedback portal. We are always happy to assist you!