初始化图像时出错:无法识别URI前缀 [英] Error intializing image : URI prefix is not recognized

查看:530
本文介绍了初始化图像时出错:无法识别URI前缀的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Image folderIcon = new Image();

folderIcon.Source = new BitmapImage(new Uri(ms-appx://Images/IconFolder.png));



URI字符串有什么问题?还是其他任何错误?



我的尝试:



我尝试单独创建一个URI变量并将其作为参数传递给BitmapImage。这也行不通。我认为问题在字符串本身内。

Image folderIcon = new Image();
folderIcon.Source = new BitmapImage(new Uri("ms-appx://Images/IconFolder.png"));

What is wrong with the URI string ? Or any other mistakes ?

What I have tried:

I have tried creating a URI variable separately and passing it as a parameter to the BitmapImage. That also does not work. I think problem is within the string itself.

推荐答案

参见 Windows 8 App:为什么我必须在我的图像源URL中指定ms-appx:///? - 堆栈溢出 [ ^ ]



使用3个斜杠或确保路径相对于代码在哪里。
See Windows 8 App: Why must I specify ms-appx:/// in my image source URL? - Stack Overflow[^]

Either use 3 slashes or make sure the path is correct relative to where the code is.


这篇关于初始化图像时出错:无法识别URI前缀的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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