// Create and show a preview image // to get fast load private static void LoadPreview(Image image, string filePath) { var previewheight = (int)((image.Parent as FrameworkElement).ActualHeight - 3.5); image.Source = BitmapImageFactory.CreateThumbnailFromFile(filePath, previewheight, WriteableBitmapEx.DesiredSize.Height); _ImageViewTransformer.SetOriginalDimentions((image.Source as BitmapImage).PixelWidth, (image.Source as BitmapImage).PixelHeight); if (!String.IsNullOrEmpty(Properties.Settings.Default.DefaultPreview)) { _ImageViewTransformer.ExecuteTransformWith(Properties.Settings.Default.DefaultPreview); } }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { string filePath = value as string; BitmapImage image = null; if (!String.IsNullOrEmpty(filePath)) { image = BitmapImageFactory.CreateThumbnailFromFile(filePath, 64, DesiredSize.Width); } return(image); }