FileStream filestream = File.OpenRead(@"C:\Users\Administrator\Desktop\queryHeaderImg.png");
BitmapImage image = new BitmapImage();
MemoryStream stream = new MemoryStream();
filestream.CopyTo(stream);
我开始将stream 赋值给BitmapImage 中的StreamSource 但是图片一直报错,
提示StreamSource 为null
查找资料 一定要要先初始货才能给StreamSource赋值。
bitmapImage.BeginInit();
bitmapImage.StreamSource = stream;
bitmapImage.EndInit();