HOW TO CHANGE IMAGE DYNAMICALLY IN WPF?

Tanuj Kumar

Total Post:134

Points:940
Posted by  Tanuj Kumar
WPF 
WPF
 3519  View(s)
Ratings:
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.

  1. Sumit Kesarwani

    Post:378

    Points:2694
    Re: How to change image dynamically in wpf?

    Hi Tanuj,


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

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

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!