【发布时间】:2014-12-08 09:26:02
【问题描述】:
我是 windows phone 8.1 开发新手,专注于 library dev。
wp 8.0时代,我知道要不要创建Image实例。
我只是写
amapLogo.Source = new BitmapImage(new Uri("/Com.AMap.Api.Maps" + ";component/Resources/ap2.data", UriKind.Relative));
这里需要指出的是,“/Com.AMap.Api.Maps”是我的库输出 dll
它工作正常。
如果我在 wp8.1 开发中保留相同的代码
出现异常
An exception of type 'System.ArgumentException' occurred in mscorlib.ni.dll but was not handled in user code
Additional information: The given System.Uri cannot be converted into a Windows.Foundation.Uri. Please see http://go.microsoft.com/fwlink/?LinkID=215849 for details.
我浏览http://go.microsoft.com/fwlink/?LinkID=215849
并找到正确设置 ImageSource 的两种方法。
ms-appx 或 ms-appx-web 方案来创建绝对 URI。
但它用于获取应用程序包中的资源
我想要的是从我的 dll 中获取资源
所以
- 如何使用设置方式创建 Image 实例 图像源。
- 或者有其他方法可以做我想做的事吗?
谢谢!
【问题讨论】:
标签: windows-runtime windows-phone-8.1