title: Can't set DialogResult in WPF
body: <p>I show a WPF window using ShowDialog() from the calling window. The window opens and is modal as expected. However, in my OK and Cancel button's click events in the dialog window I set this.DialogResult = true (or false) respectively, and the value does not get set. The window closes as expected, but DialogResult is still null. </p>
  
  <p>Is this a bug in WPF? Or is there a reason the DialogResult property cannot be set yet does not throw an exception? The window is not hosted in a browser.</p>
  
  <p>Code in the calling window:               </p>
  
  <pre><code>Window2 win = new Window2();
  bool? result = win.ShowDialog();
  if (result.HasValue &amp;&amp; result.Value) {
     //never gets here because result is always null
  }
  </code></pre>
  
  <p>Code in the dialog window:</p>
  
  <pre><code>this.DialogResult = true;
  </code></pre>