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
ImageBrush::ImageOpened_revoker ImageOpened(auto_revoke_t, RoutedEventHandler const& handler) const;
public event RoutedEventHandler ImageOpened;
function onImageOpened(eventArgs) { /* Your code */ }
imageBrush.addEventListener("imageopened", onImageOpened);
imageBrush.removeEventListener("imageopened", onImageOpened);
- or -
imageBrush.onimageopened = onImageOpened;
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 (ImageSource value) are available.

Applies to