using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Data; namespace Tango.FSE.Common.Converters { public class FilePathToIconConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { try { String file = value.ToStringSafe(); if (file != null) { var shellFile = Microsoft.WindowsAPICodePack.Shell.ShellFile.FromFilePath(file); var source = shellFile.Thumbnail.MediumBitmapSource; shellFile.Dispose(); return source; } } catch { } return null; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } }