How can I access Windows file preview icons from my WPF application

I got a bunch of pictures and videos in the directory and should be displayed in the WPF application, I am thinking of displaying the largest Win7 icons as a preview image. Because it will save me the work of capturing the corresponding frame from the video file, since Windows is already pretty good at this job. Any piece of code to access Shell icon image data?

+6
wpf thumbnails windows-shell
source share
1 answer

When using the Windows API Code Pack, you can:

Xaml

<Image x:Name="img" /> 

FROM#

  img.Source = ShellFile.FromFilePath(@"C:\path\to\file.ext").Thumbnail.BitmapSource; 

This requires the addition of Microsoft-WindowsAPICodePack-Shell and the corresponding namespaces.

+12
source share

All Articles