BitmapImage.ImageOpened event

Applies to Windows and Windows Phone

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.

Syntax


public event RoutedEventHandler ImageOpened


<BitmapImage ImageOpened="eventhandler"/>

Event information

Delegate RoutedEventHandler

Remarks

When ImageOpened fires, that serves as the notification that any asynchronous operations have completed and all the properties of a BitmapImage are ready for use. For example, to determine the size of the image before rendering it, handle ImageOpened, and check the value of the PixelWidth and PixelHeight properties on the BitmapImage that fired the event. The event data for the ImageOpened event isn't typically useful.

The Image class also has an ImageOpened event (as does ImageBrush). For the other ImageOpened events, these fire at a time when the image has probably already rendered. The BitmapImage.ImageOpened fires at a time that is potentially before you've assigned your BitmapImage to be the source of an Image or ImageBrush. If you want to change properties that affect rendering of the image based on reading properties of the BitmapImage, it's often best to handle the underlying BitmapImage's event prior to assigning it as a source.

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml.Media.Imaging
Windows::UI::Xaml::Media::Imaging [C++]

Metadata

Windows.winmd

See also

BitmapImage
ImageFailed
Image control
Quickstart: Image and ImageBrush

 

 

Show:
© 2014 Microsoft