How to change image dynamically in wpf?

Total Post:134

Points:940

WPF 
WPF
 4174  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. 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

Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.