C# 将图像源url分配给字符串
我正在创建Windows Phone 8.0应用程序 我想知道如何访问图像url的属性并将其分配给字符串 还是什么 我写C# 将图像源url分配给字符串,c#,image,windows-phone-8,C#,Image,Windows Phone 8,我正在创建Windows Phone 8.0应用程序 我想知道如何访问图像url的属性并将其分配给字符串 还是什么 我写 BitmapImage img = new BitmapImage(); img.UriSource = pic.Source; 但这是不对的, 错误: 无法将类型“System.Windows.Media.ImageSource”隐式转换为 'System.Uri' 我怎样才能做这样的事情呢?类型继承了BitmapSource并最终继承了ImageSource。所以这将通
BitmapImage img = new BitmapImage();
img.UriSource = pic.Source;
但这是不对的,
错误:
无法将类型“System.Windows.Media.ImageSource”隐式转换为
'System.Uri'
我怎样才能做这样的事情呢?类型继承了
BitmapSource
并最终继承了ImageSource
。所以这将通过铸造来完成
BitmapImage img = pic.Source as BitmapImage;
pic是图像的类型吗?