开发者

Displaying loading progress for Image control in WP7

How do I get loading progress with the percent loaded info when an image is loading?

I have this:

Image image  = new Image();
image.Source = new BitmapImage(new Uri("http://somesite.com/someimage.jpg"));

I expected something like this:

image.Loading += RoutedEventHandler(image_Loading);

but I can't find any such event. There is Loaded (not related to loading the source) and ImageOpened (which fires after loading the source is complete and has effected a layout pass).

I know it is p开发者_JAVA技巧ossible because I have seen other apps indicate loading progress for images (for example "img news reader"). Is this possible with the standard Image Control, is there a 3rd party control that provides this, or do I have to write my own?


DownloadProgress is the event I was looking for, and it was hiding in the BitmapImage class:

Image image = new Image();
BitmapImage myBitmap = new BitmapImage(new Uri("http://somesite.com/someimage.jpg", UriKind.Absolute));
myBitmap.DownloadProgress += new EventHandler<DownloadProgressEventArgs>(myBitmap_DownloadProgress);

image.Source = myBitmap;
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜