开发者

Cannot open many Images in WPF

This is my code:

foreach (Database.Photo photo in eventPhotos)
        {
            Image img = new Image();
            img.Height = 100;
            img.Width = 80;
            img.Focusable = true;
            img.MouseDown += new MouseButtonEventHandler(img_MouseDown);
            string littleString = photo.PhotoUrl;
            littleString = littleString.Replace(".jpg", "t.jpg");
            BitmapImage bi = new BitmapImage();
            bi.Begin开发者_如何学CInit();
            bi.UriSource = new Uri(littleString, UriKind.Absolute);
            bi.EndInit();
            img.Source = bi;
            imagesEvent1.Children.Add(img);
        }

But not all images are loaded.:

Cannot open many Images in WPF

in this time, images №3,5 are not loaded, in next time other images are not loaded.


The image download may be failing. Try handling the ImageFailed event on the Image control and see if that fires.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜