wpf class library with resource dictionary

大城市里の小女人 提交于 2019-12-07 17:20:11

问题


Is it possible to have a resource dictionary in a WPF class library assembly (.dll)? I ask this because I have an "Application WPF" assembly (.exe), if I try to turn the type of the assembly to "WPF Class Library" I get the error:

Impossible to specify the element ApplicationDefinition in the project file of the Library

How can I make it work?


回答1:


You get that error because one of your XAML files has a Build Action set to ApplicationDefinition. Usually, that is App.xaml. Remove that file or change it's Build Action from Properties Window to Page to stop getting that error.




回答2:


This will be the build action of one of your XAML files. I would use a WPF User Control Library or WPF Custom Control Library instead of a general class library.



来源:https://stackoverflow.com/questions/4441227/wpf-class-library-with-resource-dictionary

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!