Hi.
I have an app that shows 50 HD images/photos when the user clicks "show images". The problem is that each time the user gets back to the MainPage and then clicks "show images" again, the ApplicationPeakMemoryUsage keeps increasing until the app terminates itself...
Here's where I'm almost sure the problem is:
private void LoadXML(string fileName)
{
XDocument doc;
IsolatedStorageFile isstore = IsolatedStorageFile.GetUserStoreForApplication();
try
{
using (Stream stream = isstore.OpenFile(fileName+".xml", FileMode.Open, FileAccess.Read))
{
doc = XDocument.Load(stream, LoadOptions.None);
foreach (XElement el in doc.Root.Elements())
{
foreach (XElement element in el.Elements().Descendants())
this.Items.Add(new DataItemViewModel() { ImageSource = element.Value });
}
this.IsDataLoaded = true;
}
}
catch
{
}
}
I've tried everything, from LongListSelector, LongListMultiSelector, 3rd party image galeries templates, App.ViewModel.Items.Clear(), GC.Collect(), DataContext = null, ...
but with no sucess.
Any hints?
Thank You