Lesson 2 - Using Carousel with an ItemsControl

DXCarousel for WPF includes a CarouselItemsControl component that has built-in support for ItemsControl and CarouselPanel interaction. This topic describes how to use this component to build a simple carousel.

ItemsControl can be bound to data in order to provide visualization for every data item, and arrange data items on screen. In the CarouselItemsControl, the visualization part is the same - you specify your data, and a template which will represent each data item. The difference from the standard ItemsControl is in layout management, which is performed by a CarouselPanel. With CarouselItemsControl, you get automatic binding setup for elements (as opposed to ItemsControl usage, where you would have to supply these bindings manually).

The following code shows you how to build a simple carousel using a CarouselItemsControl.

<Page x:Class="CarouselTutorial.TutorialPage2"
    <dxca:CarouselItemsControl x:Name="carouselItemsControl" >
                <dxca:CarouselPanel AttractorPointIndex="2"/>
                <Button Content="{Binding}"/>
            <x:Array Type="sys:Int32">

As a result, you get a carousel with button elements, without having to provide item styles or property bindings.


See Also