0
在ApplicationData.Current.RomanigFolder中,我保存了一个jpg文件。可以在流或MemoryStream中读取此文件的内容并将其设置为ImageSource?在Metro应用程序中从FileSystem设置ImageSource
我用它在WPF应用中使用.NET 4.0 follwing代码:(IMG是XAML的图像控制
BitmapImage bi = new BitmapImage();
bi.BeginInit();
bi.CacheOption = BitmapCacheOption.OnLoad;
StreamReader sr = new StreamReader(data.message.imageUrl);
bi.StreamSource = sr.BaseStream;
bi.EndInit();
img.Source = bi;
sr.Close();
对于Metro应用我看到没有办法构造StreamSource设置为一个BitmapImage的,怎么能我一个图像文件设置为一个图像控制?
有没有一种方式,当文件被加载到内存控制? (就像BitmapCacheOption在WPF中给我们的) – Tristan