在后台给image souce赋值:
1.imgContent.Source =new BitmapImage(new Uri("Content.jpg", UriKind.Relative));
2.// 读取图片源文件到byte[]中 BinaryReader binReader = new BinaryReader(File.Open(strPath, FileMode.Open));
FileInfo fileInfo = new FileInfo(strPath);
byte[] bytes = binReader.ReadBytes((int)fileInfo.Length); binReader.Close(); // 将图片字节赋值给BitmapImage
BitmapImage bitmap = new BitmapImage();
bitmap.BeginInit(); bitmap.StreamSource = new MemoryStream(bytes);
bitmap.EndInit(); // 最后给Image控件赋值
imgV3.Source = bitmap;