【问题标题】:Setting image source in windows phone在 windows phone 中设置图像源
【发布时间】:2015-03-24 07:17:48
【问题描述】:

我正在尝试设置图像的来源。这里的问题是正在接收的图像的 Uri。数据来自设备锁屏。 uri是

res://UIXMobileAssets{ScreenResolution}!lock.sms.dualsim1.png

常规代码

Image imgLogo = new Image();
imgNotificationThreeLogo.Source = new BitmapImage(new Uri(spliNotifications[1], UriKind.RelativeOrAbsolute));

抛出异常“无法解析主机名”。有没有人有这方面的经验。请帮忙。

TIA。 感谢您的帮助!

【问题讨论】:

    标签: c# image silverlight windows-phone-8.1 lockscreen


    【解决方案1】:

    试试这个

            Image image = new Image();
            BitmapImage bmp = new BitmapImage();
            bmp.UriSource=new Uri (spliNotifications[1],UriKind.RelativeOrAbsolute);
            image.Source = bmp;
    

    【讨论】:

    • 如果能解释一下这段代码如何比用户现有的代码更好地解决问题,这个答案会更好。
    • 我不明白这与现有的有什么不同?还有,试过了,不行!
    • 你调试代码吗?图像路径值来了吗?您在 spliNotifications[1] 中得到了什么?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-06-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多