从外部DLL(WPF)中的资源获取图像的问题 [英] Problem in get image from resource in external dll (WPF)

查看:111
本文介绍了从外部DLL(WPF)中的资源获取图像的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我在解决方案中有两个VS2010项目。 TestProject和TestProject1。我尝试从TestProject(外部)获取资源到TestProject1(本地)。我有一个图像TestProject,它位于TestProject中名为items.xaml的资源文件中。资源在TestProject中正确加载,它被添加到mergeresources,但在两种情况下的图像,未加载。如果我在TestProject1中创建了Images \cross.png,那么图像被正确加载(但是图像不在外部dll中,在本地dll中)。



案例1(绝对)

 <  图像    IsHitTestVisible   = 错误   拉伸  = 填写   来源  =  / TestProject; component / Images / cross.png    /  >  



案例2(相对)

<前lang =xml> < 图片 IsHitTestVisible = False 拉伸 = 填充 来源 = / Images / cross.png / >







提前致谢。

解决方案

绝对Uri有什么问题?如果您的TestProject1引用了TestProject,那么您的第一个案例应该可行。我在我的项目中使用了同样的东西


Hi everyone,
I have two VS2010 project in a solution. TestProject and TestProject1. I try get the resource from TestProject(external) to TestProject1(local).I have a image TestProject, and it is in the resource file called items.xaml in TestProject. Resource is loaded correctly in TestProject and it is added to mergeresources, but image in the two case, not loaded. If only if I create a Images\cross.png in TestProject1 then image is loaded correctly(but the image is not in external dll, in local dll).

Case 1 (Absolute)

<Image IsHitTestVisible="False" Stretch="Fill" Source="/TestProject;component/Images/cross.png" />


Case 2 (Relative)

<Image IsHitTestVisible="False" Stretch="Fill" Source="/Images/cross.png" />




Thanks in advance.

解决方案

what is the problem with absolute Uri? If your TestProject1 references TestProject, your first case should work. I use the same exact thing in my projects


这篇关于从外部DLL(WPF)中的资源获取图像的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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