ImageBrush.ImageFailed Event


Occurs when there is an error associated with image retrieval or format.

Equivalent WinUI event: Microsoft.UI.Xaml.Media.ImageBrush.ImageFailed.

 virtual event ExceptionRoutedEventHandler ^ ImageFailed;
// Register
event_token ImageFailed(ExceptionRoutedEventHandler const& handler) const;

// Revoke with event_token
void ImageFailed(event_token const* cookie) const;

// Revoke with event_revoker
ImageBrush::ImageFailed_revoker ImageFailed(auto_revoke_t, ExceptionRoutedEventHandler const& handler) const;
public event ExceptionRoutedEventHandler ImageFailed;
function onImageFailed(eventArgs) { /* Your code */ }
imageBrush.addEventListener("imagefailed", onImageFailed);
imageBrush.removeEventListener("imagefailed", onImageFailed);
- or -
imageBrush.onimagefailed = onImageFailed;
Public Custom Event ImageFailed As ExceptionRoutedEventHandler 
<ImageBrush ImageFailed="eventhandler"/>

Event Type



If this event fires, that means that the ImageSource value has been asynchronously determined to not be available, or is not suitable for use. Conditions in which this event can occur include:

  • File not found
  • Invalid (unrecognized or unsupported) file format
  • Unknown file format decoding error after upload An ImageBrush in this situation won't display anything. There is no default "missing image" placeholder image for app images as there might be when a browser can't resolve an image URI. If you want behavior like that you'll have to implement it.

ImageFailed and ImageOpened are mutually exclusive. One event or the other will always file whenever an ImageBrush has the ImageSource value set or reset.

Applies to