WPF图像在运行时不显示 [英] Wpf Image dont show during runtime
本文介绍了WPF图像在运行时不显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图从文件夹更新图像,但在运行时未显示.当我使用消息框进行调试时,它工作正常.但是图像不会改变,直到运行进行.
I trying to update image from folder, but do not shows up during runtime. When i used messagebox for debug it worked fine. But the image do not change until the run is in progress.
为什么gui不更新?
如何显示文件夹中的图片?
How to display imge from folder?
推荐答案
Norbi,
Hi itNorbi,
您可以尝试以下方法.
//if you have some images in Application resource folder
var uri = new Uri("pack://application:,,,/image/4.png");
image.Source = new BitmapImage(uri);
//if you have some images in your computer folder
image.Source = new BitmapImage(new Uri(@"D:\333333.PNG", UriKind.Absolute));
在WPF中打包URI:
https://msdn.microsoft.com/en-us/library/aa970069.aspx
Pack URIs in WPF:
https://msdn.microsoft.com/en-us/library/aa970069.aspx
最好的问候,
吕汉楠
这篇关于WPF图像在运行时不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文