【问题标题】:Assigning Image source url to a string将图像源 url 分配给字符串
【发布时间】:2014-05-04 04:39:27
【问题描述】:

我正在创建一个 Windows Phone 8.0 应用程序 我想知道如何访问 Image url 的属性并将其分配给字符串

什么的

我写的

BitmapImage img = new BitmapImage();
img.UriSource = pic.Source;

但这是不对的, 错误:

无法将类型“System.Windows.Media.ImageSource”隐式转换为 'System.Uri'

我该怎么做?

【问题讨论】:

  • 图片是Image的类型吗?

标签: c# image windows-phone-8


【解决方案1】:

BitmapImage 类型继承 BitmapSource 并最终继承 ImageSource。所以这将通过强制转换来完成。

BitmapImage img = pic.Source as BitmapImage;

【讨论】:

    猜你喜欢
    • 2013-05-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-26
    • 1970-01-01
    • 2010-10-09
    相关资源
    最近更新 更多