Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><a href="http://www.packtpub.com/windows-presentation-foundation-4-5-cookbook/book" rel="noreferrer">Windows Presentation Foundation 4.5 Cookbook</a> by Pavel Yosifovich on page 155 in the section on "Using the common dialog boxes" says:</p> <blockquote> <p>"What about folder selection (instead of files)? The WPF OpenFileDialog does not support that. One solution is to use Windows Forms' FolderBrowseDialog class. Another good solution is to use the Windows API Code Pack described shortly."</p> </blockquote> <p>I downloaded the API Code Pack from <s><a href="http://archive.msdn.microsoft.com/WindowsAPICodePack" rel="noreferrer">Windows® API Code Pack for Microsoft® .NET Framework</a></s> <a href="https://stackoverflow.com/q/24081665/109702"><em>Windows API Code Pack: Where is it?</em></a>, then added references to Microsoft.WindowsAPICodePack.dll and Microsoft.WindowsAPICodePack.Shell.dll to my WPF 4.5 project. </p> <p>Example:</p> <pre><code>using Microsoft.WindowsAPICodePack.Dialogs; var dlg = new CommonOpenFileDialog(); dlg.Title = "My Title"; dlg.IsFolderPicker = true; dlg.InitialDirectory = currentDirectory; dlg.AddToMostRecentlyUsedList = false; dlg.AllowNonFileSystemItems = false; dlg.DefaultDirectory = currentDirectory; dlg.EnsureFileExists = true; dlg.EnsurePathExists = true; dlg.EnsureReadOnly = false; dlg.EnsureValidNames = true; dlg.Multiselect = false; dlg.ShowPlacesList = true; if (dlg.ShowDialog() == CommonFileDialogResult.Ok) { var folder = dlg.FileName; // Do something with selected folder string } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload