WPF类库与资源字典 [英] wpf class library with resource dictionary

查看:334
本文介绍了WPF类库与资源字典的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆