WPF类库与资源字典 [英] wpf class library with resource dictionary
问题描述
在WPF类库程序集(.dll)中是否可能有资源字典?我问这是因为我有一个应用程序WPF程序集(.exe),如果尝试将程序集的类型转换为 WPF类库,则会收到错误消息:
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:
无法在库的项目文件中指定元素ApplicationDefinition
Impossible to specify the element ApplicationDefinition in the project file of the Library
我如何制作
推荐答案
您会收到该错误,因为您的 XAML文件之一
的生成操作
设置为 ApplicationDefinition
。通常是 App.xaml
。删除该文件或将其构建操作
从属性窗口
更改为页面
停止收到该错误。
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.
这篇关于WPF类库与资源字典的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!