简体   繁体   中英

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

I got a bunch of Pictures and Videos in a directory and needs to be displayed in the WPF application, I am thinking about displaying the Win7 Large Icon itself as the preview image. Because that will save me the work of grabbing an appropriate frame from the video file since Windows is doing that job pretty well already. Any code snippet to access this Shell Icon image data?

When using the Windows API Code Pack , you can do:

XAML

 <Image x:Name="img" />

C#

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

This requires adding the Microsoft-WindowsAPICodePack-Shell package and the appropriate namespaces.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM