Mini Kabibi Habibi
<local:CarouselDemoModule x:Class="CarouselDemo.ItemsCount"
x:Name="ItemCountModule"
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"
xmlns:dxdb="http://schemas.devexpress.com/winfx/2008/xaml/demobase"
xmlns:local="clr-namespace:CarouselDemo"
xmlns:collection="clr-namespace:System.Collections;assembly=mscorlib"
xmlns:system="clr-namespace:System;assembly=mscorlib"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
>
<local:CarouselDemoModule.Resources>
<ResourceDictionary>
<dxca:ParameterCollection x:Key="parameterSet">
<dxca:Parameter Name="Scale">
<dxca:Parameter.DistributionFunction>
<dxca:PieceLinearFunction>
<dxca:PieceLinearFunction.Points>
<dxca:PointCollection>
<Point X="0" Y="0" />
<Point X="0.4" Y="0.5" />
<Point X="0.5" Y="1" />
<Point X="0.6" Y="0.5" />
<Point X="1" Y="0" />
</dxca:PointCollection>
</dxca:PieceLinearFunction.Points>
</dxca:PieceLinearFunction>
</dxca:Parameter.DistributionFunction>
</dxca:Parameter>
<dxca:Parameter Name="Opacity" DistributionFunction="{StaticResource {ComponentResourceKey TypeInTargetAssembly={x:Type dxca:CarouselPanel}, ResourceId=Linear3PConvexNr}}" />
<dxca:Parameter Name="ZIndex" DistributionFunction="{StaticResource {ComponentResourceKey TypeInTargetAssembly={x:Type dxca:CarouselPanel}, ResourceId=Linear3PConvexERIntMax}}" />
</dxca:ParameterCollection>
</ResourceDictionary>
</local:CarouselDemoModule.Resources>
<dxdb:DemoModuleControl>
<dxdb:DemoModuleControl.OptionsContent>
<StackPanel Orientation="Vertical" VerticalAlignment="Top" HorizontalAlignment="Stretch" Width="200">
<dx:GroupFrame Header="Visible Item Count">
<dxe:TrackBarEdit Name="itemCountSlider"
EditValue="4"
Minimum="1"
Maximum="7"
TickFrequency="1"
IsSnapToTickEnabled="True"
TickPlacement="Both"
LargeStep="1"
/>
</dx:GroupFrame>
</StackPanel>
</dxdb:DemoModuleControl.OptionsContent>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="80" />
</Grid.RowDefinitions>
<dxca:CarouselItemsControl x:Name="itemsControl">
<dxca:CarouselItemsControl.ItemContainerStyle>
<Style TargetType="{x:Type ContentControl}">
<Setter Property="RenderTransformOrigin" Value="0.5, 0.5" />
<Setter Property="Opacity" Value="{Binding Path=(dxca:CarouselPanel.Parameters).Opacity, RelativeSource={RelativeSource Self}}" />
<Setter Property="Panel.ZIndex" Value="{Binding Path=(dxca:CarouselPanel.Parameters).ZIndex, Converter={local:DoubleToIntConverter}, RelativeSource={RelativeSource Self}}" />
<Setter Property="RenderTransform">
<Setter.Value>
<TransformGroup>
<ScaleTransform ScaleX="{Binding Path=(dxca:CarouselPanel.Parameters).Scale, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ContentControl}}}"
ScaleY="{Binding Path=(dxca:CarouselPanel.Parameters).Scale, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ContentControl}}}"
/>
<TranslateTransform X="{Binding Path=(dxca:CarouselPanel.Parameters).OffsetX, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ContentControl}}}"
Y="{Binding Path=(dxca:CarouselPanel.Parameters).OffsetY, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ContentControl}}}"
/>
</TransformGroup>
</Setter.Value>
</Setter>
</Style>
</dxca:CarouselItemsControl.ItemContainerStyle>
<dxca:CarouselItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<dxca:CarouselPanel RenderOptions.BitmapScalingMode="HighQuality"
x:Name="carousel"
AnimationTime="400"
VisibleItemCount="{Binding ElementName=itemCountSlider, Path=Value, Converter={local:DoubleToVisibleItemCountConverter}, Mode=TwoWay}"
AttractorPointIndex="{Binding Path=VisibleItemCount, Converter={local:VisibleItemCountToActiveElementIndexConverter}, ElementName=carousel}"
PathPadding="10, 20, 10, 20"
ClipToBounds="True"
IsInvertedDirection="True"
PathVisible="False"
Grid.Row="0"
ItemSize="100,100"
IsAutoSizeItem="True"
OffsetAnimationAddFunction="{StaticResource {ComponentResourceKey TypeInTargetAssembly={x:Type dxca:CarouselPanel}, ResourceId=InvertedSine}}"
ParameterSet="{DynamicResource parameterSet}"
>
<dxca:CarouselPanel.ItemMovingPath>
<PathGeometry Figures="M227.0925,0.5 C352.0925,0.5 453.5,40.794373 453.5,90.5 C453.5,140.20563 352.0925,180.5 227,180.5 C101.9075,180.5 0.5,140.20563 0.5,90.5 C0.5,40.794373 101.9075,0.5 227,0.5" />
</dxca:CarouselPanel.ItemMovingPath>
</dxca:CarouselPanel>
</ItemsPanelTemplate>
</dxca:CarouselItemsControl.ItemsPanel>
</dxca:CarouselItemsControl>
<dxca:CarouselNavigator Width="300"
Height="24"
Grid.Row="1"
Carousel="{Binding ElementName=itemsControl, Path=Carousel}"
/>
</Grid>
</dxdb:DemoModuleControl>
</local:CarouselDemoModule>