gpt4 book ai didi

wpf - 在我的WPF应用程序中托管Windows Shell Explorer

转载 作者:行者123 更新时间:2023-12-04 05:28:19 26 4
gpt4 key购买 nike

是否可以在WPF或WinForms窗口中嵌入Windows资源管理器文件/文件夹浏览器 View ?

我基本上想在我的应用程序窗口中托管文件/文件夹浏览器。我不想重新实现 shell 程序提供的功能,尤其是 shell 程序扩展(例如TortoiseSVN)。

最佳答案

据我所知,Windows窗体和WPF中都没有开箱即用的文件/文件夹浏览器控件。
但是,有一些商业第三方控件提供类似于Windows资源管理器的界面来浏览磁盘上的文件和文件夹。看看LogicNP的以下产品:

  • FileView Control
  • FolderView Control

  • 或者,您可以将 Windows窗体WebBrowser控件托管在WPF中,并使用它来浏览文件系统,因为它已与Windows Shell集成在一起。
    在XAML中,您可以执行以下操作:
    <Window x:Class="Samples.FilesystemBrowser"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
    Title="Filesystem Browser">
    <StackPanel>
    <WindowsFormsHost>
    <wf:WebBrowser Url="C:\" />
    </WindowsFormsHost>
    </StackPanel>
    </Window>

    请注意,Microsoft使用 .NET 3.5 SP1 添加了一个 native WPF WebBrowser控件,因此您可以选择使用它:
    <Window x:Class="Samples.FilesystemBrowser"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Filesystem Browser">
    <StackPanel>
    <WebBrowser Source="C:\" />
    </StackPanel>
    </Window>

    关于wpf - 在我的WPF应用程序中托管Windows Shell Explorer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/332364/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com