2

I get new bitmap from some other component ( dont have any control on the other component ) every 5 seconds and i need to update my wpf image control with the new bitmap ( every 5 seconds ... ).

I cant find any way to update this wpf image control in run-time.

How can i do it ?

Thanks.

Dave Clemmer
  • 3,741
  • 12
  • 49
  • 72
Yanshof
  • 9,659
  • 21
  • 95
  • 195

2 Answers2

3

There is a another question like this Setting WPF image source in code

the answer boils down to

ImgOnForm.Source = new BitmapImage(new Uri(@"/yourApp;component/img.png", UriKind.Relative));
Community
  • 1
  • 1
JoshVarga
  • 685
  • 3
  • 10
1

Here is what worked for me :

chemin = "/Assets/Images/" + nomFichier + ".gif";
MonImage.Source = new BitmapImage(new Uri(base.BaseUri, chemin));

None of the suggestions I found on the forums worked (I had no image, or an ArgumentException). But with "base.BaseUri" as first agument, it worked at last.

Myosotis
  • 239
  • 3
  • 14