我无法用包乌里从代码中访问资源的图像文件在WPF

我无法用包乌里从代码中访问资源的图像文件在WPF

问题描述:

我有一些图像资源,我的应用我想访问programaticly。

I have some image resources in my app i want to access programaticly.

现在我根据一些源代码,所以我需要通过开放的接取,所以我代码是:

Now i'm based on some source code so i need to acess via Uri so my code is :

new BitmapImage(new Uri("pack://application:,,,/YearBook;component/Resources/Output/" + i.ToString() + ".jpg", UriKind.RelativeOrAbsolute));



不过,当我试图访问它,我得到找不到资源的错误(和名字是正确的)

though when i try to access it i get error that resources not found ( and the name is right)

任何人都知道为什么。

编辑:

可能是我需要的汇编文件中添加一些组装?

Might be i needed to add some assembly in the assembly file?

在结束与。所有类型的方法可以解决这个资源,我的问题是我忘了1文件夹中的子文件夹

In the end with all types of ways to approach this resource, my problem was i forgot 1 folder in the sub folders.

这代码最终工作:

new BitmapImage(new Uri("pack://application:,,,/Resources/Images/Output/" 
+ i.ToString() + ".jpg", UriKind.Absolute)));