0

I am trying to replace my listbox without data binding for a LongListSelector with data binding. The problem I am facing (since I'm new with this) I don't find a good example how to implement properly the LongListSelector Jumplist with data binding that according to the item choose navigates to different pages.

I followed this example: http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj244365(v=vs.105).aspx#BKMK_AddingLongListSelectortoyourproject

How do I make it to navigate to different pages according to the option chosen?

Snake-leaf
  • 7
  • 1
  • 4
  • FWIW, you are asking multiple questions within one title. It's better for you and other to separate out each question so it's easier for answerers and the community. – Walt Ritscher Jan 25 '14 at 21:32
  • Sorry about that, I just left the main question. Thanks! – Snake-leaf Jan 25 '14 at 21:38
  • Do you have navigation code already, and are just looking for the way to call it from your LogListSelector? – Walt Ritscher Jan 25 '14 at 21:40
  • I was using a Tap event when the user clicked in the listboxitem (but was without databinding), so probably I need to find how to implement the selectionchanger with the navigation – Snake-leaf Jan 25 '14 at 21:43

1 Answers1

0
<phone:LongListSelector x:Name="selector" SelectionChanged="selector_SelectionChanged">

event handler (in code behind):

private void selector_SelectionChanged(object sender, SelectionChangedEventArgs e) {

  if (selector.SelectedItem == null)
    return;

  NavigationService.Navigate(new Uri("/yourNextPage.xaml", UriKind.Relative));

  selector.SelectedItem = null;
}

Here you can find example with JumpList handler: http://www.dotnetspeaks.com/DisplayArticle.aspx?ID=215

d.lavysh
  • 1,404
  • 14
  • 23
  • Thanks @d.lavysh that is kinda what I need, but how do I make it work with multiples pages? I mean, if user choose A navigate to page A, if user choose B navigate to page B and like that. – Snake-leaf Jan 26 '14 at 00:09
  • You can use selector.SelectedItem property in handler and do this: selectedItem = (YourModelType)selector.SelectedItem; – d.lavysh Jan 26 '14 at 13:02
  • thanks! But I can't figure out how to do it, if you can give me an example like you did before to navigate to one page, will be awesome, I can't figure out how to define to navigate to one or other page according to the selecteditem. (Sorry but I still need to learn more, I'm quite new and learning everyday something new). – Snake-leaf Jan 27 '14 at 19:58
  • http://stackoverflow.com/questions/18352984/wp8-tap-the-image-to-get-the-selected-item-in-longlistselector See the correct answer from this question. It's not convinient to type code in comment ^) – d.lavysh Jan 27 '14 at 21:30