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

前端 未结 1 754
刺人心
刺人心 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

     
    

    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)
提交回复
热议问题