WPF关于Generic.xaml

如果需要用到Themes/Generic.xaml作为默认风格资源文件,不要忘了该项目的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)
)]

否则,程序将自动取当前操作系统风格。

这段没有的原因很可能是WPF项目是从别处拷来而不是直接在vs里创建的。

上一篇:JavaScript学习笔记之 数组方法一 堆栈 和队列


下一篇:Java 数据类型:集合接口Collection之Set接口HashSet类;LinkedHashSet;TreeSet 类