How to set the space between selected and unselected items in .NET MAUI Carousel?
This section illustrates how to set the space between selected and unselected items in .NET MAUI Carousel. The SelectedItemOffset property gives space between the selected and unselected items in the default ViewMode.
XAML
<ContentPage.Content>
<carousel:SfCarousel
x:Name="carousel"
ItemHeight="300"
ItemWidth="200"
ViewMode="Default"
ItemsSource="{Binding ImageCollection}"
SelectedItemOffset="100"/>
</ContentPage.Content>
C#
View Model
public class CarouselViewModel
{
public CarouselViewModel()
{
ImageCollection.Add(new SfCarouselItem() { ImageName = "image1.png" });
ImageCollection.Add(new SfCarouselItem() { ImageName = "image2.png" });
ImageCollection.Add(new SfCarouselItem() { ImageName = "image3.png" });
ImageCollection.Add(new SfCarouselItem() { ImageName = "image4.png" });
ImageCollection.Add(new SfCarouselItem() { ImageName = "image5.png" });
}
private List<SfCarouselItem> imageCollection = new List<SfCarouselItem>();
public List<SfCarouselItem> ImageCollection
{
get { return imageCollection; }
set { imageCollection = value; }
}
}
Output
Conclusion
I hope you enjoyed learning how to set the space between selected and unselected items 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 comments section if you have any queries or require clarification. 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!