Search code examples
c#windows-phone-8selecteditemlonglistselector

Selecting the next item in LongListSelector windows phone 8


I have an app where a LongListSelector displayes a list of pictures from a web service, when the user then clicks the picture a large image viewer pops up and shows it.

What I would like to implement is a next key where when pressed the next item in the LongListSelector is selected.

If I was using a ListBox, I would simply use the flowing code

ListBox.SelectedIndex = ListBox.SelectedIndex + 1;

I would then handle the code in the SelectionChanged event. But LongListSelector does not have a .SelectedIndex only a .SelectedItem

Is there a similar way of doing this with a LongListSelector.

Thank you.


Solution

  • Get the SelectedItem, find out its index in your collection and then assign the item with index+1 in your collection to the SelectedItem.