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 7990425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:00:22+00:00 2026-06-04T13:00:22+00:00

I’m pulling in an XML file from the internet and loading it on the

  • 0

I’m pulling in an XML file from the internet and loading it on the phone. Everything is going correctly, minus the listbox not updating on the initial load of the application.

The simple path for the application is as follows:

On the application load, it runs the update contacts method if it has connection to the internet. If it doesn’t, it checks if it is the first load, if it is, it informs the user to connect to a mobile or wireless network before running the application, otherwise it loads old data.

In the update method, it checks a webservice to see if there has been any updates since the last update. If its the first load, it says there has been 2000 updates, forcing an update. If the update number is greater than zero, it runs the download and then loads the data(this is the issue here), otherwise it loads the old data(the current data).

The issue is after the download, it won’t load the data. Here is the code for said items.

The getData function:

private void getData()
        {
            try
            {
                using (IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
                {
                    IsolatedStorageFileStream isoFileStream = myIsolatedStorage.OpenFile("contacts.xml", FileMode.Open);
                    using (StreamReader reader = new StreamReader(isoFileStream))
                    {
                        XElement xmlContact = XElement.Parse(reader.ReadToEnd());
                        lstContacts.ItemsSource = from contact in xmlContact.Descendants("contact")
                                                               select new ContactItem
                                                               {
                                                                   ImageSource = contact.Element("Image").Value,
                                                                   FName = contact.Element("FName").Value,
                                                                   LName = contact.Element("LName").Value,
                                                                   Extension = contact.Element("Extension").Value,
                                                                   Email = contact.Element("Email").Value,
                                                                   Cell = contact.Element("Cell").Value,
                                                                   Title = contact.Element("TitleName").Value,
                                                                   Dept = contact.Element("deptName").Value,
                                                                   Office = contact.Element("officename").Value,
                                                                   ID = contact.Element("ID").Value
                                                               };
                    }
                }
            }
            catch
            {
            }
        }

the update function:

void contact_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                return;
            }

            XElement xmlContact = XElement.Parse(e.Result);
            string updates = xmlContact.Element("updates").Element("number").Value;
            if (firstrun)
            {
                updates = "2000";
                settings["firstRun"] = (bool)false;
            }
            MessageBox.Show(updates);
            if (Convert.ToInt32(updates) > 0)
            {
                MessageBox.Show("Updating Contacts");
                ContactReader cr = new ContactReader("http://domain.tld/RLContactApp/getContactsWP7.php?sqlQueryType=C&lastUpdated=01%2F01%2F2000&format=xml", "contacts.xml");
                bool downloaded = cr.Download();
                if (downloaded)
                {
                    getData();
                }
            }
            else
            {
                MessageBox.Show("Not Updating Contacts");
                getData();
            }

        }

I’m looking for a way to make the data get loaded into the Listbox without telling the user to close the app and reload it.

Any help is greatly appreciated.

  • 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-04T13:00:23+00:00Added an answer on June 4, 2026 at 1:00 pm

    convert your linq query to result by using .toList() at the end as like

      lstContacts.ItemsSource = (from contact in xmlContact.Descendants("contact")
                                                                   select new ContactItem
                                                                   {
                                                                       ImageSource = contact.Element("Image").Value,
                                                                       FName = contact.Element("FName").Value,
                                                                       LName = contact.Element("LName").Value,
                                                                       Extension = contact.Element("Extension").Value,
                                                                       Email = contact.Element("Email").Value,
                                                                       Cell = contact.Element("Cell").Value,
                                                                       Title = contact.Element("TitleName").Value,
                                                                       Dept = contact.Element("deptName").Value,
                                                                       Office = contact.Element("officename").Value,
                                                                       ID = contact.Element("ID").Value
                                                                   }).ToList<ContactItem>();
    

    now this will execute the query and return the list and that will be able to bind the data.

    try with this
    (query }).ToList();

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

Sidebar

Related Questions

In my XML file chapters tag has more chapter tag.i need to display chapters
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I'm parsing an XML file, the creators of it stuck in a bunch social
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I am trying to render a haml file in a javascript response like so:

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.