I want to create carousel in WPF like here. (left and right buttons not counted, just bullets)
I've found many solutions how to create carousel in WPF, but it isn't exactly what i need. I have listBox of images:
<ListBox Name="productImages" HorizontalAlignment="Center" VerticalAlignment="Center" IsSynchronizedWithCurrentItem="True" ItemsPanel="{StaticResource HorizontalItemsPanel}" ItemsSource="{Binding Source={StaticResource ImagesCollectionView}}" ItemContainerStyle="{StaticResource ProductImageContainerStyle}">
<ListBox.GroupStyle>
<GroupStyle Panel="{StaticResource HorizontalItemsPanel}" />
</ListBox.GroupStyle>
</ListBox>
and slider bullets:
<ListBox BorderThickness="0" Grid.Row="1" Height="20" VerticalAlignment="Top" Background="#66000000">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="Margin" Value="0" />
</Style>
</ListBox.ItemContainerStyle>
<ListBoxItem>
<Border Background="#4CFFFFFF" Width="6" Height="6" CornerRadius="3"></Border>
</ListBoxItem>
<ListBoxItem>
<Border Background="#FFFFFF" Width="6" Height="6" CornerRadius="3"></Border>
</ListBoxItem>
<ListBoxItem>
<Border Background="#4CFFFFFF" Width="6" Height="6" CornerRadius="3"></Border>
</ListBoxItem>
<ListBoxItem>
<Border Background="#4CFFFFFF" Width="6" Height="6" CornerRadius="3"></Border>
</ListBoxItem>
</ListBox>
I don't know how to create "relation" between them - when I click on bullet, image with same index should be shown.
Simple XAML. What i mean in comment:
Image - where we can see our image. ListBox - our bullets. I don't remove selection borders, but it's just a sample.
Image is binded to SelectedItem.Image property, so our context must be something with this property.
About manipulation. I'm using ListCollectionView as DataContext and OnManipulationCompleted event.
As I have tested, it's work perfectly.