ImageBrush.ImageOpened Event


Occurs when the image source is downloaded and decoded with no failure. You can use this event to determine the size of an image before rendering it.

// Register
event_token ImageOpened(RoutedEventHandler const& handler) const;

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

// Revoke with event_revoker
ImageOpened_revoker ImageOpened(auto_revoke_t, RoutedEventHandler const& handler) const;
public event RoutedEventHandler ImageOpened;
Public Custom Event ImageOpened As RoutedEventHandler 
<ImageBrush ImageOpened="eventhandler"/>

Event Type



For the scenario of checking the size of an image before rendering, that info isn't part of the ImageOpened event data. Instead, the fact that the event fired is the notification that the PixelHeight and PixelWidth values of the image source (@"Microsoft.UI.Xaml.Media.ImageBrush.ImageSource?text=ImageSource" value) are available.

Applies to