Hi,
I want the carousel to stop scrolling left when the first item is in the centre of the screen (the topmost item).
I also want the carousel to stop scrolling right when the last item is in the centre of the screen (the topmost item).
Currently, you can continue scrolling left/right until the first or last item is on the extreme left or right of the screen.
Is there anyway to do this?
Also, is there anyway of setting the carousel to wrap around when you come to the end of the items?
Thanks
I want the carousel to stop scrolling left when the first item is in the centre of the screen (the topmost item).
I also want the carousel to stop scrolling right when the last item is in the centre of the screen (the topmost item).
Currently, you can continue scrolling left/right until the first or last item is on the extreme left or right of the screen.
Is there anyway to do this?
Also, is there anyway of setting the carousel to wrap around when you come to the end of the items?
Thanks
4 Answers, 1 is accepted
0
Hello James,
Maya
the Telerik team
I am sending you a sample project illustrating how you may achieve the desired result. Let me know in case it does not meet your requirements.
Maya
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Robert
Top achievements
Rank 1
answered on 16 Sep 2011, 02:50 AM
Hi there,
I tried your example as it works when moving through the items using the control buttons, however when scrolling with the mouse scroll wheel it still continues past the first and last items.
Are you able to stop as required when using the mouse scroll wheel?
Thanks,
Rob
I tried your example as it works when moving through the items using the control buttons, however when scrolling with the mouse scroll wheel it still continues past the first and last items.
Are you able to stop as required when using the mouse scroll wheel?
Thanks,
Rob
0
Hello Robert,
Best wishes,
Maya
the Telerik team
That would be the expected behavior since the logic for moving till the centered item is implemented only for the Click events of the buttons. If you want to get similar behavior when scrolling, you can try to handle ScrollChanged event of the ScrollViewer and implement the required logic:
<
telerik:RadCarouselScrollViewer.ScrollChanged
=
"RadCarousel_ScrollChanged"
/>
Best wishes,
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Jonah
Top achievements
Rank 1
answered on 17 Dec 2012, 10:07 PM
Just wanted to post here just in case anyone else is looking for a solution to this. In your selectionChanged event of your Carousel you can determine if you can go right or left such as
if (sgCarousel.SelectedItem != null)Then in your PreviewMouseWheel event you can do the following
{
int index = sgCarousel.Items.IndexOf(sgCarousel.SelectedItem);
if (index == 0)
{
_canGoRight = false;
}
else
{
_canGoRight = true;
}
if (sgCarousel.Items.Count - 1 == index)
{
_canGoLeft = false;
}
else
{
_canGoLeft = true;
}
}
if (e.Delta < 0 && !_canGoLeft)This should make it so you always have an item on top.
{
e.Handled = true;
}
if (e.Delta > 0 && !_canGoRight)
{
e.Handled = true;
}