Make own windows 8 app theme
I'm working on an app, and want to apply my own style to it. XAML have something called theme directories which I trying to use for my themes. As it turns out, windows has 3 predefined themes; Light, Dark, and HighContrast. When I set the x:Key property on the Resource Directory containg the theme I want to use to something else than one of the 3 predefined or Default, it does not work. Anyone know why?
<ResourceDictionary.ThemeDictionary>
<ResourceDictionary x:key="Default"> // Does work
(...)
</ResourceDictionary>
<ResourceDictionary x:key="MyOwnThemeKey"> // Does not work
(...)
</ResourceDictionary>
</ResourceDictionary.ThemeDictionary>
From here:
A theme dictionary is a special type of merged dictionary that is intended to hold the resources that vary depending on which theme a user is currently using on his or her PC. For example, the "light" theme might use a white color brush whereas the default theme might use a dark color brush. The brush changes, but otherwise the composition of a control that uses the brush as a resource could be the same, just by referencing a theme resource.
And from here:
One or more ResourceDictionary object elements. Each such ResourceDictionary must have an x:Key attribute. The value of that attribute must be unique and should reference a known theme name. Each resource dictionary and the contents thereof should be intended to supply theme values for named resources that are otherwise consumed by other resources. For example, a theme dictionary for "HighContrast" might include redefinitions for some or all of the Brush or Color keyed resources used elsewhere in other style or transition resources, in order to produce the necessary contrast levels to satisfy high-contrast design requirements.
Basically a theme dictionary is intended to modify an existing theme and is selected based on the current OS theme. If there is no OS theme of that name then there is no way to select it.
链接地址: http://www.djcxy.com/p/68012.html上一篇: 允许用户自定义主题颜色
下一篇: 制作自己的Windows 8应用主题