Skip to content

Latest commit

 

History

History
33 lines (22 loc) · 2.44 KB

image_imageopened.md

File metadata and controls

33 lines (22 loc) · 2.44 KB
-api-id -api-type
E:Microsoft.UI.Xaml.Controls.Image.ImageOpened
winrt event

Microsoft.UI.Xaml.Controls.Image.ImageOpened

-description

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

-xaml-syntax

<Image ImageOpened="eventhandler"/>

-remarks

When ImageOpened fires, that serves as the notification that any asynchronous operations have completed and all the properties of the object used as the image source are ready for use. For example, to determine the size of the image, handle ImageOpened, and check the value of the PixelWidth and PixelHeight properties on the object referenced as Image.Source. The event data for the ImageOpened event isn't typically useful.

When the Image element isn’t in the live visual tree, the Image element will not fire ImageOpened or ImageFailed events. If you need to receive these events while the element isn’t in the live tree, use the BitmapImage.ImageOpened/ImageFailed events.

Image resources

Resources can use a resource qualifier pattern to load different resources depending on device-specific scaling. Any resource that was originally retrieved for your app is automatically re-evaluated if the scaling factor changes while the app is running. In addition, when that resource is the image source for an Image object, then one of the source-load events (ImageOpened or ImageFailed) is fired as a result of the system's action of requesting the new resource and then applying it to the Image. The scenario where a run-time scale change might happen is if the user moves your app to a different monitor when more than one is available. As a result, ImageOpened or ImageFailed events can happen at run-time when the scale change is handled, even in cases where the Source is set in XAML.

-examples

-see-also

ImageFailed, Image and ImageBrush