Quickstart: Using file or image resources (XAML)
You can add images and other file resources to your app, and reference those files from within your app. Support for swapping images based on high contrast settings or display scaling is built in, if you follow the instructions below for naming and organizing your file resources in folders.
- Create tailored images or other file assets for different scales (dpi) and contrast settings.
Create your images at several recommended sizes, to ensure that your app looks great when Windows scales it. See the guidelines for scaling to pixel density.
Create multiple copies of each image:
- Original size, for a typical 96dpi device.
- 140% the original size. For example, a 100x100px image should also have a 140x140px image version.
- 180% the original size. For example, a 100x100px image should also have a 180x180px image version.
- 240% the original size, for Windows Phone apps. For example, a 100x100px image should also have a 240x240px image version.
- For the logo, wideLogo, and smallLogo resources specified in the app's manifest file, 80% of the original size. For example, a 100x100px image should also have an 80x80px image version. See App images and Tile image sizes.
- High contrast image with a black background and white foreground at the original size.
- High contrast image with a white background and black foreground at the original size.
Name the images with qualifiers for the various scales and contrast settings:
- name.scale-80.ext (For the logo, wideLogo, and smallLogo resources)
In this example, name.ext is the name of the image as referenced in code and markup.
Place the images side by side in the same folder. For example:
- Refer to the images in XAML without the qualifiers.
- Refer to the images in code without the qualifiers.
- Refer to the image in the manifest without the qualifiers.
- Open the Package.appxmanifest file in Microsoft Visual Studio.
- Edit the manifest reference to refer to the file in the correct element or attribute, such as:
Some images or other files may need to be localized, particularly when they contain text or culturally sensitive material. Files can also vary depending on a user's location, separate from their language. For example, a map may have different borders depending on the user's location, but the labels should follow the user's preferred language.
Files can be marked or qualified with basic folder and file name conventions for all different user and device configurations. See How to name resources using qualifiers for more details on qualifying resources, and for a list of qualifiers.
- How to name resources using qualifiers
- App images
- Guidelines for scaling to pixel density
- Tile image sizes
- Roadmap for creating apps using C#, C++, or VB