【发布时间】:2014-10-23 12:00:49
【问题描述】:
我花了 1 个小时浏览互联网并试图找到一种方法如何将 Uri 加载到内容图像并创建 BitmapImage。
这就是我所拥有的:
{
Uri x = new Uri("/Images/appbar.chevron.up.png", UriKind.Relative);
BitmapImage bi = new BitmapImage(x);
return x;
}
解决方案资源管理器中的图像就在项目下:
并且每个图像都有构建动作作为内容
我在创建 BitmapImage 时收到 The given System.Uri cannot be converted into a Windows.Foundation.Uri. Please see http://go.microsoft.com/fwlink/?LinkID=215849 for details.,但调试器显示 Uri 已创建:
请告诉我,如何加载选定的图像?
【问题讨论】:
-
您是否搜索过异常?就是这样:stackoverflow.com/questions/7569720/…
-
是的,我用
ms-appx:尝试了选项。它也不起作用。 -
不起作用永远不会解释任何事情。解释会发生什么。有什么例外吗?错误?
-
您是否使用位图作为控件的内容?如果是这样,您可以在 Xaml 中设置它吗?
标签: c# image windows-runtime