WPF类库与资源字典

编程入门 行业动态 更新时间:2024-10-25 04:14:59
本文介绍了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类库与资源字典

本文发布于:2023-11-12 03:40:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1580404.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字典   类库   资源   WPF

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!