自定义控件不能显示: ThemeInfoAttribute

来源:互联网 发布:为什么会用反射java 编辑:程序博客网 时间:2024/05/23 00:58

检查了所有情况,后来才发现没有在assembly中定义ThemeInfoAttribute。如果创建wpf项目,wizard会自动帮你生产ThemeInfo,我的project是通过class library生成的,所以必须自己定义。这就让我想起某位牛人的话:永远不要相信wizard生成的代码,至少你必须搞明白每一行wizard为你生成的代码。

 

 

 

 

 

 

 

 

[

 

 

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)

)]

原创粉丝点击