I am trying to load a xml file to my app and show it on a ListBox. The problem is that the xml file is about 5 MB, and it takes about 40 seconds on the phone to load. and when the phone locks the screen and returns back it takes another 40 seconds. I tried to use the isolatedstorage to store the data on it but it didn’t improve performance. This is my code to load the data:
XDocument loadedData = XDocument.Load("BigFile.xml");
var data = from query in loadedData.Descendants("w")
orderby (string)query.Element("e")
select new myClass
{
First = (string)query.Element("a"),
Second = (string)query.Element("e")
};
ListBox.ItemsSource = data.ToList<myClass>();
Is there anyway to speed up the loading?
To improve performance you can do the following: