-1

Another absolute brain eater is, it is so difficult to have a simple OpenFolder Dialog in WPF .NET 7.0.

I have following configuration in my WPF project file. VS2022 Version 17.5.1

<OutputType>WinExe</OutputType>
<TargetFramework>net7.0-windows</TargetFramework>
<UseWPF>true</UseWPF>

In Order to use OpenFolder dialog...

  1. -- if i Add System.Windows.Forms.dll, kicks of error in most lines of existing code.
  2. -- Microsoft.Win32 only has OpenFile And SaveFile dialog, makes no sense.
  3. -- So many fork of Microsoft.WindowsAPICodePack that its difficult to find which is original from MSFT.

Does anyone have a solution?

Neha
  • 319
  • 1
  • 7

1 Answers1

2

OpenFolder dialog is a part of Windows Forms. Add this to your csproj:

// other stuff
<UseWPF>true</UseWPF>
<UseWindowsForms>true</UseWindowsForms>
Lukasz Szczygielek
  • 2,768
  • 2
  • 20
  • 34