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

前端 未结 1 775
刺人心
刺人心 2021-02-09 19:51

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 im

相关标签:
1条回答
  • 2021-02-09 20:15

    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.

    0 讨论(0)
提交回复
热议问题