0

I'm working with windows phone app so in my mainpage I have a listbox that contain data from web service json data that have href and what I want to do is when I selecting one of the listbox item i will navigate to detail page that will getting data from web service with this href. I'm using mvvm patern and i don't know how to pass this href into my detailpage mainviewmodel property

and for listbox i'm using telerik raddataboundlistbox (well maybe there is some different feature than normal listbox)

PamanBeruang
  • 1,531
  • 5
  • 27
  • 64
  • A good post about Navigating and passing data is here: http://stackoverflow.com/questions/20004086/is-there-a-typesafe-way-of-navigating-between-screens-in-windows-phone – Romasz Jan 17 '14 at 08:49

1 Answers1

0

For this you would have to pass QueryString, use this code in your mainpage:

private void lstYourlstNames_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
{           
   yourListType yourselected_href  = lstBookNames.SelectedItem as yourListType;

   NavigationService.Navigate(new Uri("/View/EBookContainer.xaml?SelectedHref=" + "yourselectedhref", UriKind.RelativeOrAbsolute));
}

In your detail page declare a string variable like this:

string Href;

and get href like this:

NavigationContext.QueryString.TryGetValue("SelectedBook", out Href);
Romasz
  • 29,662
  • 13
  • 79
  • 154
Pradeep Kesharwani
  • 1,480
  • 1
  • 12
  • 21