Search code examples
windows-phone-7.1flickr

how to get the url of selected image in a listbox populated by flickr feed in windows phone 7


i am using the public feed from flickr to display the thumbnails of images in a listbox. I need to get the url of the selected image so that i can load the full image below the listbox. How to do so?the feed url is here

XElement XmlTweet = XElement.Parse(e.Result);

       XNamespace ns = "http://search.yahoo.com/mrss/"; // flilckr
       listBox1.ItemsSource = from tweet in XmlTweet.Descendants("item")
                               select new FlickrData
                               {

                                   ImageSource = tweet.Element(ns + "thumbnail").Attribute("url").Value,
                                   Message = tweet.Element("description").Value,
                                   UserName = tweet.Element("title").Value,
                                   PubDate = DateTime.Parse(tweet.Element("pubDate").Value)

                               };

Solution

  • Register SelectionChanged Event of listbox, in that

      void ListboxSelectionChanged(object sender, SelectionChangedEventArgs e)
      {
          Listbox list = sender as Listbox;
          FlickrData data = list.SelectedItem as FlickrData;
    
          string url = data.ImageSource ;
       }