WPF:跨程序集共享资源 [英] WPF: Sharing resources across assemblies

查看:62
本文介绍了WPF:跨程序集共享资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

之前发布了一个关于使用主题跨程序集共享资源的问题/generic.xamlComponentResourceKey 标记扩展.该解决方案运行良好,但它要求所有共享资源都位于 generic.xaml 资源字典中.我的越来越大,所以我想我会使用 generic.xaml 中的合并字典来组织事物.

I previously posted a question on sharing resources across assemblies using Themes/generic.xaml and the ComponentResourceKey markup extension. The solution works nicely, but it requres all of the shared resources to be located in the generic.xaml resource dictionary. Mine is getting rather large, so I thought I would use merged dictionaries in generic.xaml to organize things.

到目前为止我没有运气.我使用上一篇文章中的演示运行了一些测试,一旦我将资源移动到合并字典,ComponentResourceKey 就会失败,抱怨它找不到合并字典的源文件.

I have had no luck so far. I ran some tests using the demo from my previous post, and as soon as I move resources to a merged dictionary, the ComponentResourceKey fails, complaining that it can't find the source file for the merged dictionary.

有没有其他人让这个工作?如何?感谢您的帮助.

Has anyone else gotten this working? How? Thanks for your help.

推荐答案

您可以使用 单独程序集中的 WPF 资源字典

这篇关于WPF:跨程序集共享资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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