Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
604
XamCarouselListBox - selected item always in the center
posted

Hi

I would like to make sure that the selected item is alsways in the middle.

To achieve this in the CarouselSelectionChanged event handler I used the

XamCarouselPanelCommands

 

.NavigateToNextItem and

XamCarouselPanelCommands

 

.NavigateToPreviousItem commands.

The problem:

In the carousel loaded event handler I make the first item (indexed 0) selected.

carousel.SelectedIndex = 0;

Then I scroll the carousel to previous item 4 times (since I have 9 items per page, and I basicaly need to bring the selected item 0 to center). I do the following:

 

 

 

for (int i = 0; i < 4; i++)

{panel.ExecuteCommand(

XamCarouselPanelCommands.NavigateToPreviousItem);}

But those lines make no effect. The selected index 0 is still at the left side of the carousel.

How can I make this work?

Thank you

Parents
No Data
Reply
  • 69686
    Suggested Answer
    posted

    Hello,

    If you need to scroll the items when they are loaded, you have to turn off the transition animation

    You can do that like this:

    xamCarouselListBox1.ViewSettings.ShouldScrollItemsIntoInitialPosition = false;

    Let me know if that is what you are looking for.

Children
No Data