private static UIElement CreateBitmapContent(string fileName) { // Use Begin/EndInit to avoid locking the file on disk var bmp = new BitmapImage(); bmp.BeginInit(); bmp.UriSource = new Uri(fileName); bmp.CacheOption = BitmapCacheOption.OnLoad; bmp.EndInit(); var image = new NonScaledImage(); image.Source = bmp; return(image); }
private static UIElement CreateBitmapContent(string fileName) { // Use Begin/EndInit to avoid locking the file on disk var bmp = new BitmapImage(); bmp.BeginInit(); bmp.UriSource = new Uri(fileName); bmp.CacheOption = BitmapCacheOption.OnLoad; bmp.EndInit(); var image = new NonScaledImage(); image.Source = bmp; return image; }