You can override any of these existing styles by specifying a ResourceDictionary as part of the ThemeDictionaries. You can also change these values at runtime in code.ÄarkContainer.RequestedTheme = ElementTheme.Dark This allows you to change themes within the context of any element, even nested. To allow this, Microsoft added a RequestedTheme property to the FrameworkElement object. With the dynamic themes comes a broader reach for theme changing. This allows the resources to be updated dynamically whenever changes to the theme occur, previously this required an application restart. While StaticResource still works, with Windows 8.1, you can use the new ThemeResource markup extension for these references. To use them in Windows 8 you would just use a StaticResource. Microsoft provides a reference of the XAML theme resources. ![]() ![]() This keeps your app consistent with the Windows experience, and also manages cases where users change their underlying system preferences for things like accessibility. When you create a new Windows 8.1 app it behooves you use the built-in brushes and styles. ![]() I was working on a sample today and wanted to write a short post to show how to put this all together with the combination of ThemeDictionaries to create a dynamic app. There is also a new RequestedTheme property on FrameworkElement, which allows for retargeting specific islands of content. Windows 8.1 offers a new markup extension called ThemeResource, this allows for dynamic theming of your app at runtime.
0 Comments
Leave a Reply. |