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.:
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.
精彩评论