Under System.Windows.Controls
, I can see a PrintDialog
However, I can't seem to find a native FileDialog
. Do I need to create a reference to System.Windows.Forms
or is there another way?
WPF does have built-in (although not native) file dialogs. Specifically, they are in the slightly unexpected Microsoft.Win32
namespace (although still part of WPF). See the OpenFileDialog
and SaveFileDialog
classes in particular.
Do however note that these classes are only wrappers around the Win32 functionality, as the parent namespace suggests. It does however mean that you don't need to do any WinForms or Win32 interop, which makes it somewhat nicer to use. Unfortunately, the dialogs are by default style in the "old" Windows theme, and you need a small hack in app.manifest
to force it to use the new one.