I'm trying to force image control (BigImageURL)'s web address with image control. This works mostly, but for some images I am getting a HTTP 403 error (detected using Fidler) and clearly the image is not displayed. I want to display a static image when the Http url is not resolved.
& lt; Image x: name = "hoverimage" source = "{binding bigimageURL}" /> I tried to write a converter Public category UriToImageSourceConverter: IValueConverter {convert to public object (object value, type target type ) {Bitmap image image = null; Try {image = new bitmap image (new urine (value.ToString ()); } Hold (exception before) {image = new bitmap image (new Uri (".. ..lt; mydefaultimageUrl» .. ")); } Return image; } ...} & lt; Image x: Name = "Hover Image" Source = "{Compulsive Big Image URL, Converter = {Static Resources Mayuroid Image Source Contour}" / & gt; not working !! Although the image URL was not accessible, the converter did not throw any exception. I do not think this bitmap tries to solve the address or read the image stream while creating the image
Tried a fallback value, but it does not work either.
& lt; Image x: name = "hover image" source = "{binding bigimage URL, fallback value = default url}" /> any sign ??
Thank you in advance
Actually you have to do something like this < Pre> & lt; Image x: name = "hover image" source = "{binding bigimage URL}" image format = "hover image_image" /> and add event handler
Private Zero HoverImage_ImageFailed (Object Sender, ExceptionRoutedEventArgs e) {var expection = e.ErrorException; // Here we can find out what the hover image is. Source = someDefaultUrl; // And here we add the default URL ...} In a piece of silver you do not have to control the loader's image and image exception with the help of events ... in that case Do not use databases for. .
Comments
Post a Comment