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 file stored in app data (see Chapter 19, “Working with Data”), 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 ...

Get Universal Windows® Apps with XAML and C# 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.