title: A WPF/Prism window calling CommonOpenFileDialog (select directory) loses focus after selection
body: <p>I have a WPF (Prism) application that needs "select directory" functionality. The main window's menu opens a child "Settings" window through notorious Prism <code>InteractionRequest</code>. That "Settings" window has a button to open a "Select Directory" window.</p>
  
  <p>Since the standard <code>FolderBrowserDialog</code> dialog is so ugly, I tried to use a <code>CommonOpenFileDialog</code> from <a href="https://github.com/aybe/Windows-API-Code-Pack-1.1" rel="nofollow">Windows API Code Pack</a>. </p>
  
  <p>I use a service from <code>Orc.Controls</code> to wrap the dialog:</p>
  
  <pre><code>using Microsoft.WindowsAPICodePack.Dialogs;
  
  public class MicrosoftApiSelectDirectoryService : ISelectDirectoryService
  {
      public bool DetermineDirectory()
      {
          var browserDialog = new CommonOpenFileDialog();
          browserDialog.IsFolderPicker = true;
          browserDialog.Title = Title;
          browserDialog.InitialDirectory = InitialDirectory;
  
          if (browserDialog.ShowDialog() == CommonFileDialogResult.Ok)
          {
              DirectoryName = browserDialog.FileName;
              return true;
          }
  
          DirectoryName = string.Empty;
          return false;
      }
  // ...
  }
  </code></pre>
  
  <p>From my view model, I call <code>_selectDirectoryService.DetermineDirectory()</code>:</p>
  
  <pre><code>    public DelegateCommand SelectDirectoryCommand { get; private set; }
  
      private void SelectDirectory()
      {
          if (_selectDirectoryService.DetermineDirectory())
          {
              var dir = _selectDirectoryService.DirectoryName;
              // ...
          }
      }
  </code></pre>
  
  <p>The problem is that after selecting a directory in a <code>CommonOpenFileDialog</code>, the "Settings" window loses focus (and for some reason actually hides behind the maximized main window). By contrast, the <code>FolderBrowserDialog</code> returns focus to the "Settings" window.</p>
  
  <p>So, basically I need either a better "select directory" implementation or I need to find a way to focus the "Settings" window again without severe violation of MVVM pattern. Any ideas would be appreciated.</p>