In a pivot, i'm loading images, each image dynamically created as an pivot item and whose source is an URL. It works fine for 10 images, but if there are more images it is crashing.
The problem is no error is shown in the debugging too. this is the code i'm using to add images as the pivot items
foreach (Photo photo in Albumcollection)
{
PivotItem pivotItem = new PivotItem();
Image image = new Image();
image.Height = 450;
image.Width = 450;
BitmapImage bitmapImage = new BitmapImage();
bitmapImage.UriSource = new Uri(photo.URL, UriKind.Absolute);
开发者_JAVA技巧 image.CacheMode = new BitmapCache();
image.Source = bitmapImage;
image.Stretch = Stretch.Uniform;
image.Margin = new Thickness(0);
StackPanel stackPanel = new StackPanel();
stackPanel.Children.Add(image);
pivotItem.Content = stackPanel;
pivotItem.Header = photo.Name;
PvtPhotos.Items.Add(pivotItem);
}
What is the reason of crash and what is the solution?
Out of memory?
You can check memory consumption per
Device Information for Windows Phone
精彩评论