Get the Topmost Item in RadCarousel
Environment
Product | RadCarousel for WPF |
Description
How to get the uppermost item in RadCarousel.
Solution
You can access the RadCarouselPanel, through the FindCarouselPanel method of the RadCarousel. Then you can utilize its TopContainer property. It will return the CarouselItem visual element, however you can check its DataContext to get the bound object in an MVVM scenario.
RadCarouselPanel carouselPanel = this.MyCarousel.FindCarouselPanel();
var topContainer = carouselPanel.TopContainer;
var dataContext = (topContainer as CarouselItem).DataContext;
<telerik:RadCarousel x:Name="MyCarousel"
ItemsSource="12345"/>
You can handle the TopContainerChanged event of the RadCarouselPanel in order to get notified when the TopContainer changes.