ResourceDictionary中的一个单独的程序 [英] ResourceDictionary in a separate assembly

查看:186
本文介绍了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中的一个单独的程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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