title: WPF DataTrigger setters changing Window Width and Height not having effect
body: <p>I've extended <code>Window</code> to add some functionality, and part of this is the ability to specify a specific window size or allow it to size to the content. The codebehind looks like this, currently un-MVVMified.</p>
  
  <pre class="lang-cs prettyprint-override"><code>public partial class DialogWindow : Window
  {
      public bool HasSize { get; set; }
  
      public Size Size { get; set; }
  }
  </code></pre>
  
  <p>The XAML then looks like this:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;Window ... Name="DialogWindowElement"&gt;
      &lt;Window.Style&gt;
          &lt;Style TargetType="Window"&gt;
              &lt;Style.Triggers&gt;
                  &lt;DataTrigger Binding="{Binding HasSize, ElementName=DialogWindowElement}" Value="True"&gt;
                      &lt;Setter Property="Width" Value="{Binding Size.Width, ElementName=DialogWindowElement}" /&gt;
                      &lt;Setter Property="Height" Value="{Binding Size.Height, ElementName=DialogWindowElement}" /&gt;
                  &lt;/DataTrigger&gt;
                  &lt;DataTrigger Binding="{Binding HasSize, ElementName=DialogWindowElement}" Value="False"&gt;
                      &lt;Setter Property="SizeToContent" Value="WidthAndHeight" /&gt;
                  &lt;/DataTrigger&gt;
              &lt;/Style.Triggers&gt;
          &lt;/Style&gt;
      &lt;/Window.Style&gt;
      &lt;ContentControl ...&gt;
          &lt;!-- Content control using DataTemplates to determine content --&gt;
      &lt;/ContentControl&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p>Resizing to content seems to work okay, but the specified width and height aren't applied. Any large content expands to all the size it needs instead of being constrained and then resizable later.</p>
  
  <p>Snoop and other such tools imply the trigger is fired, but the setters don't seem to be having any effect.</p>
  
  <p>Am I missing something here?</p>
  
  <p>Edit: Added content control to the window to provide some more context</p>