wpf中使用Ookii.Dialogs.Wpf操作文件和文件夹

date
Nov 22, 2021
slug
10006
status
Published
tags
wpf
C#
summary
type
Post
Nuget中安装Ookii.Dialogs.Wpf
添加三个botton,然后
using System.Windows;
using Ookii.Dialogs.Wpf;
namespace WpfApp10
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
VistaFolderBrowserDialog vfbd = new VistaFolderBrowserDialog();
		private void button_Click(object sender, RoutedEventArgs e)
    {
        VistaFolderBrowserDialog vfbd = new VistaFolderBrowserDialog();

        if (vfbd.ShowDialog() == true)
        {
            MessageBox.Show(vfbd.SelectedPath);
        }
    }

    private void button1_Click(object sender, RoutedEventArgs e)
    {
        //VistaFileDialog vfd = new VistaFileDialog();
        VistaOpenFileDialog vofd = new VistaOpenFileDialog();
        vofd.Filter = "SEGD Files|*.segd|SEGY Files|*.segy";
        if (vofd.ShowDialog()==true)
        {
            MessageBox.Show(vofd.FileName);
        }
    }

    private void button2_Click(object sender, RoutedEventArgs e)
    {
        VistaSaveFileDialog vsfd = new VistaSaveFileDialog();
        if (vsfd.ShowDialog()==true)
        {
            MessageBox.Show(vsfd.FileName);
        }
    }
}}

© Wen Bo 2021 - 2022