title: Weighted distribution of child elements in ItemsControl
body: <p>I want to create a horizontal layout bound to a list of objects with some information to display. I want the size of the controls in this control to space out to fill the control, like the UniformGrid does. 
  The thing is, I do not want the control's widths to be uniformly distributed, but rather weighted, based on a property in the object itself.</p>
  
  <p>I thought an ItemsControl with a custom ItemsPanelTemplate would be a good strategy, because it works fine with a UniformGrid:</p>
  
  <pre><code>&lt;ItemsControl x:Name="itemsControl" ItemsSource="{Binding MyResults}"&gt;
      &lt;ItemsControl.ItemsPanel&gt;
          &lt;ItemsPanelTemplate&gt;
              &lt;UniformGrid Rows="1" /&gt;
          &lt;/ItemsPanelTemplate&gt;
      &lt;/ItemsControl.ItemsPanel&gt;
      &lt;ItemsControl.ItemTemplate&gt;
          &lt;DataTemplate&gt;
              &lt;Border BorderBrush="Black" BorderThickness="1"&gt;
                  &lt;TextBlock Width="{Binding Weight}" Text="{Binding Weight}" /&gt;
              &lt;/Border&gt;
          &lt;/DataTemplate&gt;
      &lt;/ItemsControl.ItemTemplate&gt;
  &lt;/ItemsControl&gt;
  </code></pre>
  
  <p>Bound to the view model:</p>
  
  <pre><code>public class MainViewModel : PropertyChangedBase
  {
      public List&lt;MyTestClass&gt; MyResults { get; set; } = new List&lt;MyTestClass&gt;()
      {
          new MyTestClass() { Weight = 25 },
          new MyTestClass() { Weight = 50 },
          new MyTestClass() { Weight = 25 }
      };
  }
  
  public class MyTestClass
  {
      public int Weight { get; set; }
  }
  </code></pre>
  
  <p>One idea is to switch to an ordinary Grid and use the ColumnDefinitions *-width behavior (like <code>(25*,50*,25*)</code> but bound as <code>Weight*</code>), but I can't figure out how to do that.</p>