开发者

windows phone 7: loading images from URL crash the application

开发者 https://www.devze.com 2023-01-23 11:41 出处:网络
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.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消