title: Is there a WPF layout control that can be used to dynamically shift between a row and column layout?
body: <p>I was originally asked to make a control whose child controls were stacked vertically and would fit into the container in which they were placed completely filling that , but after seeing this design I was asked to make them stack horizontally if the aspect ratio were long and thin. Something like the image below;</p>
  
  <p><a href="https://i.stack.imgur.com/t0nbE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/t0nbE.png" alt="Correct layout - all space is filled"></a></p>
  
  <p>I have tried various different containers in various combinations but never quite get what I am after. The closest I get is using a wrap panel, the problem is that the three different parts of the control dont stretch to fit the parent container. The effect I get is closer to this;</p>
  
  <p><a href="https://i.stack.imgur.com/ZrRI6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZrRI6.png" alt="The closest I got"></a></p>
  
  <p>I got this using something like this.</p>
  
  <pre><code>    &lt;WrapPanel&gt;
          &lt;Grid&gt;
              &lt;Grid.RowDefinitions&gt;
                  &lt;RowDefinition/&gt;
              &lt;/Grid.RowDefinitions&gt;
              &lt;Textbox/&gt;
          &lt;/Grid&gt;
  
          &lt;Grid&gt;
              &lt;Grid.RowDefinitions&gt;
                  &lt;RowDefinition/&gt;
              &lt;/Grid.RowDefinitions&gt;
              &lt;Textbox/&gt;
          &lt;/Grid&gt;
  
          &lt;Grid&gt;
              &lt;Grid.RowDefinitions&gt;
                  &lt;RowDefinition/&gt;
              &lt;/Grid.RowDefinitions&gt;
              &lt;Textbox/&gt;
          &lt;/Grid&gt;
      &lt;/WrapPanel&gt;
  </code></pre>
  
  <p>As you can see I cannot get the controls to fill the container. Is there a way to achieve this?</p>