반응형
FileDialog / FolderDialog
nuget에서 WindowsAPICodePack-Shell 을 설치 한다.
using Microsoft.WindowsAPICodePack.Dialogs;
private void btnFile_Click(object sender, RoutedEventArgs e)
{
CommonOpenFileDialog dialog = new CommonOpenFileDialog();
if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
txtPath.Text = dialog.FileName;
}
private void btnFolder_Click(object sender, RoutedEventArgs e)
{
CommonOpenFileDialog dialog = new CommonOpenFileDialog();
// 폴더 선택
dialog.IsFolderPicker = true;
if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
txtPath.Text = dialog.FileName;
}
반응형
'Development > WPF' 카테고리의 다른 글
[WPF] ComboBox 에 Checked / UnChecked 이벤트 (0) | 2022.01.16 |
---|---|
[WPF] Grid에 GridSplitter 넣기 (0) | 2021.12.22 |
[WPF] 다른 프로젝트의 ResourceDictionary (리소스사전) 참조 (추가) 하기 (0) | 2020.12.14 |
[WPF] Watermark TextBox 만들기 (Resource) (1) | 2020.12.10 |
[WPF] DataGrid 에서 Rows Count (0) | 2020.07.13 |