In my Windows Phone app I fill a longlistselector with data from a web api and by inputting the data to a class using
private void NewDownloaded(object sender, DownloadStringCompletedEventArgs e)
{
if (e.Result == null || e.Error != null)
{
MessageBox.Show("There was an error connecting to the server");
}
else
{
XDocument loadedData = XDocument.Parse(e.Result);
var data = from query in loadedData.Descendants("pattern")
select new newpatterns
{
ID = (string)query.Element("id"),
Title = (string)query.Element("title"),
UserName = (string)query.Element("userName"),
DateCreated = (string)query.Element("dateCreated"),
Url = (string)query.Element("Url"),
};
newlonglist.ItemsSource = data.ToList();
}
}
then when the an item is selected in the long list selector I navigate to a second page. using
private void newlonglist_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
LongListSelector selector = sender as LongListSelector;
if (selector == null)
return;
newpatterns newdata = selector.SelectedItem as newpatterns;
if (newdata == null)
return;
//MessageBox.Show(newdata.Hex);
NavigationService.Navigate(new Uri("/NewImagePage.xaml?id=" + newdata.ID, UriKind.Relative));
newlonglist.SelectedItem = null;
}
My problem is then in on the secondpage "NewImagePage.xaml" I want to find find this selected item in the call from the ID so I can get the rest of the data, is there a way to do this with out passing it all as a query string..
Thanks..