I have managed to reproduce your problem -- it is triggered by the OnItemSelected
event Handler. It happens because your two items are right at the beginning of your path(really because you actually have no other items on the path). Since RadCarouselPanel
has no knowledge of the selection (this logic should come from its parent, in your case this is your ListBox
control that hosts RadCarouselPanel
), it will not try and bring any item into view as it is loaded. This has to be done manually by calling the either BringItemIntoView()
methods, or any of the IScrollInfo
methods for that matter they will all realize and bring your data into view.
Now the difference beween using BringItemIntoView()
is that the first will look for the item in the RadCarouselPanel Children collection. That means you can use the method only with realized items. The second method will use the items generator to find the right data item in the ItemsControl Children Collection (your ListBox children collection).
However the BringDataItemIntoView()
, formerly an internal method, was never meant to work in scenarios where initially you'll have no realized items like it is your case. For this reason we have made some changes to cover such situations. We have a new build reflecting these changes that could be sent to you. To do that please open a new support ticket.
If you decide to go that route, you could modify your OnItemSelected
event handler so that it calls the BringDataItemIntoView()
(not the BringItemIntoView()
) method at the end. This will select and bring into view the right CarouselItem.
|private void OnItemSelected(object sender, RoutedEventArgs e)
| // the UIElement that was selected
| ListBoxItem item = (ListBoxItem) e.OriginalSource;
| RadCarouselPanel panel = GetCarouselPanel(sender as ItemsControl);
Sorry for the inconvenience, and thanks for helping improve our product!
the Telerik team
Check out Telerik Trainer
, the state of the art learning tool for Telerik products.