title: MVVM and Databinding with UniformGrid
body: <p>I'm trying to style the back of a WPF chart with some rectangles. I'm using MVVM, and I need the rectangles to be uniformly sized. When defined via Xaml, this works with a fixed "BucketCount" of 4:</p>
  
  <pre><code>&lt;VisualBrush&gt;
    &lt;VisualBrush.Visual&gt;
    &lt;UniformGrid Height="500" Width="500" Rows="1" Columns="{Binding BucketCount}"&gt;
      &lt;Rectangle Grid.Row="0" Grid.Column="0" Fill="#22ADD8E6" /&gt;
      &lt;Rectangle Grid.Row="0" Grid.Column="1" Fill="#22D3D3D3"/&gt;
      &lt;Rectangle Grid.Row="0" Grid.Column="2" Fill="#22ADD8E6"/&gt;
      &lt;Rectangle Grid.Row="0" Grid.Column="3" Fill="#22D3D3D3"/&gt;
    &lt;/UniformGrid&gt;        
   &lt;/VisualBrush.Visual&gt;
  &lt;VisualBrush&gt;
  </code></pre>
  
  <p>How can I bind my ObservableCollection of Rectangles? There is no "ItemsSource" property on UniformGrid. Do I need to use an ItemsControl? If so, how can I do this?</p>
  
  <p>Thanks in advance.</p>