initialization - How to check BitmapImage instance is initialized or not? WPF -
i try use instances of bitmapimage class in circle receive error messages bitmapimage not initialized. how check bitmapimage initialized before use it?
there 2 events commonly used when working bitmaps, 1 fires of when image opened , when image failed;
var myimage = new bitmapimage(new uri(@"images/img.jpeg",urikind.relative)); myimage.imageopened += myimage_imageopened; myimage.imagefailed += myimage_imagefailed; void myimage_imagefailed(object sender, exceptionroutedeventargs e) { //handle failed event } void myimage_imageopened(object sender, routedeventargs e) { //handle image opend ok event }
Comments
Post a Comment