在Silverlight应用程序,我有一个的BitmapImage定义为System.Windows.Media.Imaging.BitmapImage
和它作为一个调用的方法“SetSource
”我在哪里可以设置这样的源:加载WPF中的BitmapImage的来源?
BitmapImage bitmap = new BitmapImage();
System.IO.Stream stream = _scene.GetStream();
if (stream == null) return;
bitmap.SetSource(stream);
在WPF应用程序我也有一个 位图图像定义为System.Windows.Media.Imaging.BitmapImage
,但没有SetSource方法。我如何在Silverlight应用程序中设置WPF应用程序中的源代码?
此外,它是一个流,而不是一个字符串。它不是一个URI。所以“UriSource”方法不起作用。我试过这个:
System.IO.Stream stream = _scene.GetStream();
if (stream == null) return;
BitmapImage bitmap = new BitmapImage();
bitmap.UriSource = new Uri(stream.ToString());
而在运行时,它抛出一个错误,无法确定URI。该URI是Intranet的标识符吗?你确定这不是银光的事吗?我做一个WPF应用程序