题
我从其他一些组件(对其他组件都没有任何控制)获得新的位图每5秒钟,我需要使用新的位图更新WPF映像控件(每5秒...)。
我找不到在运行时更新此WPF图像控件的任何方法。
我该怎么做 ?
谢谢。
解决方案
还有一个这样的问题在代码中设置WPF图像源
答案归结为
ImgOnForm.Source = new BitmapImage(new Uri(@"/yourApp;component/img.png", UriKind.Relative));
其他提示
这是对我有用的原因:
chemin = "/Assets/Images/" + nomFichier + ".gif";
MonImage.Source = new BitmapImage(new Uri(base.BaseUri, chemin));
我在论坛上发现的任何建议都没有奏效(我没有图像或参数证明)。但是以“ base.baseuri”为第一个gument,它终于起作用了。
不隶属于 StackOverflow