Home > DeveloperSection > Forums > How to change image dynamically in wpf?
Tanuj Kumar

Total Post:134

Points:940
Posted on    September-03-2013 5:17 AM

 WPF WPF 
Ratings:


 1 Reply(s)
 2905  View(s)
Rate this:

myImage.Source = new BitmapImage(new Uri("/folder/imagename.png", UriKind.Relative));

This used to work in WPF applications for Windows 7, but there, in Windows 8, I got an error

Thanks in advance.



Sumit Kesarwani

Total Post:378

Points:2694
Posted on    September-03-2013 7:47 AM

Hi Tanuj,

The Image.Source property is of type ImageSource. Therefore, try the following example:

myImage.Source = "/YourApplicationName;component/folder/imagename.png";


Don't want to miss updates? Please click the below button!

Follow MindStick