Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

How to: Setup a Simple Carousel

This sample shows how to create a basic carousel that has elements of two types in it. Styles are defined for both elements, so that they can be controlled by the CarouselPanel. See the Basic Principles topic, for more information.

<Page x:Class="CarouselTutorial.TutorialPage1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:dxca="http://schemas.devexpress.com/winfx/2008/xaml/carousel"
    >
    <dxca:CarouselPanel AttractorPointIndex="2" VisibleItemCount="5" x:Name="myCarousel">
        <dxca:CarouselPanel.Resources>
            <Style TargetType="{x:Type Rectangle}" BasedOn="{StaticResource 
                {ComponentResourceKey TypeInTargetAssembly={x:Type dxca:CarouselPanel}, 
                ResourceId=advancedCarouselItemStyle}}"/>
            <Style TargetType="{x:Type Ellipse}" BasedOn="{StaticResource
                {ComponentResourceKey TypeInTargetAssembly={x:Type dxca:CarouselPanel}, 
                ResourceId=advancedCarouselItemStyle}}">
                <Setter Property="Opacity" Value="1" />
            </Style>
        </dxca:CarouselPanel.Resources>
        <Rectangle Fill="Red"/>
        <Rectangle Fill="Green"/>
        <Rectangle Fill="Blue"/>
        <Rectangle Fill="Yellow"/>
        <Rectangle Fill="Purple"/>
        <Ellipse Fill="OrangeRed"/>
    </dxca:CarouselPanel>
</Page>