ImageBrush.ImageOpened Event

Definition

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.

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

// 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;
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

RoutedEventHandler

Remarks

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 (@"Windows.UI.Xaml.Media.ImageBrush.ImageSource?text=ImageSource" value) are available.

Applies to