我有这样一个项目;我想所有的图像中的图像文件夹中。
I have a project like this; I want to get all the images in the "Images" folder.
如果所有的PNG文件存储在磁盘上的文件夹中,这将是容易的。
If all the png files are stored in a folder on the disk, this would be easy.
但它们嵌入在项目,那么我怎么能访问它们?
But they are embedded in the project, then how can I access them?
甚至进一步,我怎么了图像资源的树数据结构?
Or even further, how do I get a tree data structure of the image resources?
感谢
推荐答案
您可以使用包URI访问它们:
You can access them using a package URI:
Image image = new Image();
image.Source = new BitmapImage(new Uri("pack://application:,,,/Images/ImageCategory1/Burn Disc.png"));
如果你想获得的文件夹结构:
If you want to get the folder structure:
恐怕没有文件夹结构以外,在项目结构被添加到每个资源的名称
I am afraid there is no folder structure other than that the structure in the project is added to the name of each resource.
幸运的是有一种方法来枚举所有资源:searching和上市WPF资源字典文件夹中的
Fortunately there is a way to enumerate all resources: searching and listing WPF resource dictionaries in a folder
相关推荐
最新文章