Hello,
I am using the carousel control with a custom path. With the setting VisualMode="CustomPath", the control looses its nice carousel behavior (you can't click through its items in one direction without reaching an end anymore). I tried to fix this problem by moving the elements in the ObservableCollection, which is used as ItemsSource, from the end to the beginning of the list or vice versa (depending on which direction the carousel turns). Unfortunately It doesn't work as desired.
When i run the application, I get an an:
"unhandeled exception of type 'System.ArgumentOutOfRangeException' occurred in PresentationCore.dll. Additional information: Specified argument was out of the range of valid values."
Here is my method, which runs after each SelectedIndexChanged event:
internal void AdjustCollection(Carousel Carousel)
{
carousel = Carousel;
//Coll is the ObservableCollection used as ItemsSource
int center_index = Coll.Count / 2 + 1;
int selected_index = Carousel.SelectedIndex;
if (selected_index > center_index)
{
while(selected_index != center_index)
{
Coll.Move(0,Coll.Count-1);
selected_index--;
}
}
else
{
while (selected_index != center_index)
{
Coll.Move(Coll.Count-1,0);
selected_index++;
}
}
}
Does anyone have an idea of what I am doing wrong or how I can reach my goal in another way?
Kind regards,
Janosch
Attachment:
CarouselSample_1a3cb908.zip