title: WPF Array Property Binding
body: <p>I can't seem to figure this one out, no matter how much similar solutions I find on the internet. Here's my problem.</p>
  
  <p>I have a Brushes[] property in my WPF UserControl (MyControl). I want to be able to style instances of this control with several statically defined brushes. I was thinking that the XAMl would looks something like</p>
  
  <pre><code>&lt;Snip&gt;
      &lt;Window.Resources&gt;
      &lt;Color x:Key="ColorA"&gt;#304B82&lt;/Color&gt;
      &lt;Color x:Key="ColorB"&gt;#F3F3F3&lt;/Color&gt;
  
      &lt;x:ArrayExtension Type="Brush" x:Key="myBrushes"&gt;
      &lt;SolidColorBrush Color="{StaticResource ColorA}"/&gt;
      &lt;SolidColorBrush Color="{StaticResource ColorB}"/&gt;
      &lt;/x:ArrayExtension&gt;
  
      &lt;Style&gt;
         //Magic here to apply myBrushes to the Brushes array
      &lt;/Style&gt;
  
      &lt;/Window.Resources&gt;
  
  
      &lt;MyNamespace:MyControl&gt;
      &lt;/MyNamespace:MyControl&gt;
  &lt;Snap&gt;
  </code></pre>
  
  <p>The .cs File with MyControl holds this gem. At some point I'm using Brushes to draw something.</p>
  
  <pre><code>    public Brush[] Brushes
      {
          get { return (Brush[])GetValue(BrushesProperty); }
          set { SetValue(BrushesProperty, value); }
      }
  
      public static readonly DependencyProperty BrushesProperty = DependencyProperty.Register(
        "Brushes", typeof(Brush[]), typeof(MyControl), new PropertyMetadata(new Brush[]{}));
  </code></pre>
  
  <p>Well, as you can imagine absolutely nothing is working so far. Would be much obliged for some pointers in the right direction.</p>