每当我创建一个新的 WPF 应用程序或 WPF 用户控件库时,AssemblyInfo.cs
文件都会包含以下属性:
[assembly: ThemeInfo(
ResourceDictionaryLocation.None,
//where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly
//where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
ThemeInfo
属性有什么用?如果我删除它会破坏任何东西吗?
最佳答案
ThemeInfo 属性指定自动主题化机制应在何处查找主题词典和通用词典。每个选项都可以设置为以下值之一:
- 无(默认):不查找资源字典。
- SourceAssembly:字典是当前程序集。
- ExternalAssembly:字典在不同的程序集中,必须命名
<AssemblyName>.<ThemeName>.dll
, 其中<AssemblyName>
是当前程序集的 姓名。
如果主题字典为在外部程序集中定义的控件指定样式,例如,WPF 控件,如 System.Windows.Controls.ProgressBar
和 System.Windows.Button
, 那么你必须使用 ThemeDictionaryExtension
将应用程序指定为主题词典的来源。
关于c# - ThemeInfo 属性有什么用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1163013/