I want to disable the automatic movement of carousel item, which takes the current clicked carousel item to the top container.
thanks
5 Answers, 1 is accepted
Could you provide a bit more details about the behavior you require? Do you want your items not to be moved in the centered once they are clicked or you just want to remove the animation?
Maya
the Telerik team
I have two items in carousel and it has 2 items per page. But whenever i click on any item it shifts to get the focus. i want to stop that movement. And want to show both the items in my carousel.
i want to stop that shifting of carousel item
The behavior you experience is the expected one since when the ItemsPerPage property is set to 2, the topmost position is the one on the right - that is why when you click on the left item, it goes to that top position and the other item moves out of the view port.
What you can try is to set ItemsPerPage to 3, thus this topmost position will be placed in the center and none of the items will be hidden on a single click.
The other possible approach would be to leave ItemsPerPage set to 2 and set CanUserSelect property of RadCarousel to "False" In that way the carousel will not be scrolled at all on clicking on an item.
I am attaching a sample project illustrating both approaches.
Please take a look at it and let me know whether any of it is appropriate for you scenario.
Maya
the Telerik team
Actually i have images as the caraousel data, and i want to display enlarged view of data in a different popup by double clicking that.
Canuserselect propert fulfills the first requirement, but how can we acheive the requirement of opening the enlarged view popup can be acheived.
Thanks :)
You can try handling MouseDoubleClick event. You can get the corresponding item as follows:
private void RadCarousel1_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
var clickedElement = e.OriginalSource as FrameworkElement;
if(clickedElement != null)
{
var carouselItem = clickedElement.ParentOfType<
CarouselItem
>();
}
}
Once you have the clicked carousel item, you can display it in a window, popup or whatever element you need.
Will that approach be suitable for you ?
Regards,
Maya
the Telerik team