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

Theme Resources

Windows Store and universal apps don’t support DynamicResource, but they can use a ThemeResource mechanism to handle light versus dark app themes or handle switching into and out of the high contrast Windows themes. ThemeResource works like WPF’s DynamicResource, but its refresh behavior is limited to theme changes.

To enable this, ResourceDictionary has a ThemeDictionaries property that can contain separate ResourceDictionarys, one for each possible theme. The correct one automatically gets merged into the host ResourceDictionary based on the current theme. These theme dictionaries can contain any resource, but it’s common for them to contain specific Brushes. The following XAML demonstrates:

<

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