O'Reilly logo

XAML Unleashed by Adam Nathan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Loading File Variations Manually

If your app loads external files (such as from your own Web server), then you cannot take advantage of automatic resource qualifier support. However, you can certainly mimic it in C# by inspecting the aspects of the current environment you care about. The following Windows Store C# code demonstrates how you might fetch different files based on the current automatic scaling and contrast mode:

void LoadImage(Image image, string filename){  // Either "Scale100Percent", "Scale140Percent", or "Scale180Percent":  string scale = DisplayProperties .ResolutionScale.ToString();  // Getting the current user theme is a bit more onerous:  AccessibilitySettings settings = new AccessibilitySettings ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required