ResourceDictionary in a separate assembly(ResourceDictionary 在单独的程序集中)
问题描述
我有想要在多个单独的应用程序中使用的资源字典文件(MenuTemplate.xaml、ButtonTemplate.xaml 等).我可以将它们添加到应用程序的程序集中,但最好将这些资源编译到一个程序集中并让我的应用程序引用它,对吗?
I have resource dictionary files (MenuTemplate.xaml, ButtonTemplate.xaml, etc) that I want to use in multiple separate applications. I could add them to the applications' assemblies, but it's better if I compile these resources in one single assembly and have my applications reference it, right?
构建资源程序集后,如何在我的应用程序的 App.xaml 中引用它?目前我使用 ResourceDictionary.MergedDictionaries 来合并各个字典文件.如果我将它们放在程序集中,如何在 xaml 中引用它们?
After the resource assembly is built, how can I reference it in the App.xaml of my applications? Currently I use ResourceDictionary.MergedDictionaries to merge the individual dictionary files. If I have them in an assembly, how can I reference them in xaml?
推荐答案
查看 打包 URI 语法.你想要这样的东西:
Check out the pack URI syntax. You want something like this:
<ResourceDictionary Source="pack://application:,,,/YourAssembly;component/Subfolder/YourResourceFile.xaml"/>
这篇关于ResourceDictionary 在单独的程序集中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:ResourceDictionary 在单独的程序集中


- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01
- C# 中多线程网络服务器的模式 2022-01-01
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- MoreLinq maxBy vs LINQ max + where 2022-01-01
- 输入按键事件处理程序 2022-01-01
- 如何用自己压缩一个 IEnumerable 2022-01-01
- C#MongoDB使用Builders查找派生对象 2022-09-04
- WebMatrix WebSecurity PasswordSalt 2022-01-01