Set Image Source in WPF
Posted on: Tue Aug 04 12:32:32 -0700 2009. Updated on: Thu Aug 06 11:04:16 -0700 2009.
Category: WPF
Category: WPF
Setting the Image.Source property in WPF. Note this is slightly different than in silverlight because it requires an object holding the image data as source.
private void SetPageViewImage(string sourceFile)
{
Uri uri = new Uri(sourceFile, UriKind.Relative);
ImageSource imgSource = new BitmapImage(uri);
PageViewImage.Source = imgSource;
PageViewImage.Visibility = Visibility.Visible; //optional
}