I am using a CarouselView
and a Timer
to have it make the changing effect every X seconds.
Now as I am finding out there are a few bugs. ScrollTo
doesn't really scroll the CarouselView
to the position asked. Setting the Position property
doesn't help neither.
They will just scroll the position to higher or lower than the current position depending on the parameter sent.
Here is the C#
for any testing:
Device.StartTimer(TimeSpan.FromSeconds(2), () =>
{
slidePosition++;
if (slidePosition == (CarouselView1.ItemsSource as ObservableCollection<LinksHeaderTitles>).Count - 1)
{
for (int i = slidePosition - 2; i >= 0; i--)
{
CarouselView1.ScrollTo(0, animate: false);
}
slidePosition = 0;
}
CarouselView1.ScrollTo(slidePosition);
return true;
});
Is there any better workaround to reseting the position to 0 after the last item was reached?