Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8715335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:49:14+00:00 2026-06-13T05:49:14+00:00

I have code which takes in data from Flickrs Rest service and populates a

  • 0

I have code which takes in data from Flickrs Rest service and populates a ListView. This code works fine and when I run my app I can search for photos and be displayed a list of them. However I want to then get a single photos data but when I try to access this data from the ListView it’s completely empty (Iv debugged it and it just contains null entries). I don’t have a lot of experience with C# so could anyway advise me as to why I would be getting null results?

        private async void ParseFlickrResponse(HttpResponseMessage response)
    {

        XDocument xml = XDocument.Parse(await response.Content.ReadAsStringAsync());          
        var photos = from results in xml.Descendants("photo")
                     select new FlickrImage
                     {
                         ImageId = results.Attribute("id").Value.ToString(),
                         FarmId = results.Attribute("farm").Value.ToString(),
                         ServerId = results.Attribute("server").Value.ToString(),
                         Secret = results.Attribute("secret").Value.ToString(),
                         Title = results.Attribute("title").Value.ToString()
                     };

        FlickrListView.ItemsSource = photos;




    }

EDITED

Current code:

enter code here:

private async void ParseFlickrResponse(HttpResponseMessage response)
{

        XDocument xml = XDocument.Parse(await response.Content.ReadAsStringAsync());          
        var photos = from results in xml.Descendants("photo").ToList()
                     select new FlickrImage
                     {
                         ImageId = results.Attribute("id").Value.ToString(),
                         FarmId = results.Attribute("farm").Value.ToString(),
                         ServerId = results.Attribute("server").Value.ToString(),
                         Secret = results.Attribute("secret").Value.ToString(),
                         Title = results.Attribute("title").Value.ToString()
                     };


        FlickrListView.ItemsSource = new ObservableCollection<FlickrImage>(photos);


    }

    private void GetPhotoSource(object sender, ItemClickEventArgs e)
    {

        int inx = FlickrListView.SelectedIndex;
       // FlickrImage t = lst.First();
        FlickrImage t = lst.ElementAt(inx);
        MyImage.Source = new BitmapImage(new Uri(t.ImageUrl.ToString(), UriKind.Absolute));  


    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T05:49:15+00:00Added an answer on June 13, 2026 at 5:49 am

    Try adding a .ToList() at the end of your LINQ.

    *EDIT (comments summary)

    You are handling ItemClick event which seems to be raised before the selection properties on the ListViewBase change. Since these are not updated at this point – you can check e.ClickedItem and cast it to FlickrImage to get your clicked item.

    If you do want to work with selection properties – you should be handling the SelectionChanged event.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code (XCode 4, using Storyboards with ARC) which takes data from
I have code, which i want to run, this takes a few mins so
I have this code, which contains a BufferedReader and reads the HTML data from
This code takes data from a php file which is doing a json_encode, which
I have an api which takes uni code data as c character array and
Problem Hello all! I have this code which takes my jpg image loops through
I have created a piece of code which takes an IP address (from main
I have the following code which takes an input from an xml and creates
I have some code which loads a jpg from data and displays it in
I have an UITextView which takes data from XML. Now that XML node is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.