public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value != null) { string path = value.ToString(); if (File.Exists(path)) { return(FromStream(LargeIcon.ExtractAssociatedIcon(path as string, LargeIcon.IconSize.Size32x32).ToBitmap())); } string ext = System.IO.Path.GetExtension(path); return(FromStream(LargeIcon.ExtractAssociatedIcon(ext, LargeIcon.IconSize.Size32x32).ToBitmap())); } return(FromStream(LargeIcon.ExtractAssociatedIcon(".exe", LargeIcon.IconSize.Size32x32).ToBitmap())); }