gpt4 book ai didi

c# - 制作自己的 windows 8 应用程序主题

转载 作者:行者123 更新时间:2023-11-30 22:24:34 27 4
gpt4 key购买 nike

我正在开发一款应用,并希望将我自己的风格应用到其中。XAML 有一个叫做主题目录的东西,我试图将其用于我的主题。事实证明,Windows 有 3 个预定义的主题;浅色、深色和高对比度。当我将包含我要使用的主题的资源目录上的 x:Key 属性设置为 3 个预定义或默认值之一以外的其他内容时,它不起作用。有人知道为什么吗?

<ResourceDictionary.ThemeDictionary>
<ResourceDictionary x:key="Default"> // Does work
(...)
</ResourceDictionary>
<ResourceDictionary x:key="MyOwnThemeKey"> // Does not work
(...)
</ResourceDictionary>
</ResourceDictionary.ThemeDictionary>

最佳答案

来自 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.

来自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.

基本上,主题词典旨在修改现有主题,并根据当前操作系统主题进行选择。如果没有该名称的操作系统主题,则无法选择它。

关于c# - 制作自己的 windows 8 应用程序主题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12743027/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com