title: Limit row's height on both "Auto" and "1*" in WPF
body: <p>I have a WPF application which layout consists of 3 rows in a top level <code>Grid</code>.</p>
  
  <p>I want the middle row to use up the space it needs (the maximum space it needs is limited but depends on the width of the window).
  The bottom row shall use up the remaining space.
  The tricky part is the top row.
  Its size can vary depending on a button which toggles the visibility of a large part of the content. I want it to use at most 50% of the height but not more than it really needs.
  The following XAML describes what I want to accomplish:</p>
  
  <pre><code>    &lt;Grid.RowDefinitions&gt;
          &lt;!-- neither "1*" nor "Auto" fully meets my needs --&gt;
          &lt;RowDefinition Height="Min(1*,Auto)"&gt;&lt;/RowDefinition&gt;
  
          &lt;RowDefinition Height="Auto"&gt;&lt;/RowDefinition&gt;
  
          &lt;RowDefinition Height="1*"&gt;&lt;/RowDefinition&gt;
      &lt;/Grid.RowDefinitions&gt;
  </code></pre>
  
  <p>The rows are:</p>
  
  <ol>
  <li><code>WrapPanel</code></li>
  <li><code>WrapPanel</code></li>
  <li><code>TextBox</code></li>
  </ol>
  
  <p>if this is important.</p>