The Image Element

Image enables images of multiple formats to be rendered: BMP, PNG, GIF, JPEG, JPEG-XR, TIFF, and even ICO files. It has a Source property of type ImageSource, but thanks to a type converter, you can set the property to a simple string in XAML, as in this example:

<Image Source="Assets/Logo.png"/>

Source can point to an image file packaged with your app (a resource), a local file, or an image from the Web. The content is fetched and processed asynchronously, so a slow network connection doesn’t impact your app’s responsiveness. When Source is set, it results in either an ImageOpened event being raised on success, or an ImageFailed event being raised on failure. In the latter case, the Image element ...

Get XAML Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.