title: How to make WPF wrappanel child items to stretch?
body: <p>I'd like to create an <code>ItemsControl</code> where child items are placed like a <code>WrapPanel</code>, but child Items should take as much space as it can. So that when the window size gets larger or smaller, the child items should stretch according to a certain width:height ratio. When the child items get added or removed from the <code>ItemsControl</code>'s <code>ItemsSource</code>, the <code>WrapPanel</code> should place linebreaks among items appropriately to keep child item's width:height ratio.<br/>
  Below is what I have so far. Is it possible to do this in Xaml? or should I create a custom control for this? Thanks in advance!</p>
  
  <pre><code>&lt;Window&gt;
  &lt;Grid&gt;
      &lt;ItemsControl ItemsSource="{Binding DataCollection}"&gt;
         &lt;ItemsControl.ItemsPanel&gt;
            &lt;ItemsPanelTemplate&gt;
               &lt;WrapPanel Orientation="Vertical"/&gt;
            &lt;/ItemsPanelTemplate&gt;
         &lt;/ItemsControl.ItemsPanel&gt;
         &lt;ItemsControl.ItemTemplate&gt;
            &lt;DataTemplate&gt;
               &lt;Border BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Stretch"&gt;
                  &lt;StackPanel Orientation="Horizontal" &gt;
                     &lt;TextBlock TextWrapping="Wrap" Text="{Binding Name}" /&gt;
                     &lt;TextBlock TextWrapping="Wrap" Text="{Binding Value}"/&gt;
                     &lt;TextBlock TextWrapping="Wrap" Text="{Binding Time,  StringFormat='hh:mm:ss' }"/&gt;
                  &lt;/StackPanel&gt;
               &lt;/Border&gt;          
           &lt;/DataTemplate&gt;
         &lt;/ItemsControl.ItemTemplate&gt;
      &lt;/ItemsControl&gt;
  &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>