Quantcast
Channel: Retrieve image at run-time
Viewing all articles
Browse latest Browse all 7

Retrieve image at run-time

$
0
0
You haven't specified exactly how the image is "in" your WPF application.

Have you added it to your Visual Studio project with a Build Action of "Resource"?

If so, you can use the following relative Uri syntax (adjust the path if you put it in a subfolder):

            image1.Source = new BitmapImage(new Uri("/Forest.jpg", UriKind.Relative));
For an image on disk (not an embedded resource in your application), use the absolute path on disk:

image1.Source = new BitmapImage(new Uri(@"c:\images\Forest.jpg", UriKind.Absolute));

Viewing all articles
Browse latest Browse all 7

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>