title: Keeping dialogs on top of window, but not on top of everything
body: <p>In my WPF application I have a lot of custom dialog boxes that pop open so the user can do various things with <code>someDialogClass.ShowDialog()</code>. To make sure that the dialog stays on top of the window that called it, I add <code>Topmost="True"</code> to the <code>Window</code> tag of the dialog's XAML file. This works, but the dialog is shown over <em>every</em> window open—even other applications. This is really annoying. So is there a way to have the dialog forced to always be on top of its parent, but not necessarily on top of other applications?</p>
  
  <p>Here is a simplified version of the <code>Window</code> tag of the dialogs I have (omitting all the <code>xmlns</code> stuff):</p>
  
  <pre><code>&lt;Window
  mc:Ignorable="d"
  ShowInTaskbar="False"
  Topmost="True"
  WindowStartupLocation="CenterOwner"
  ResizeMode="NoResize"
  SizeToContent="WidthAndHeight"
  WindowStyle="ToolWindow"&gt;
  </code></pre>