title: Populating custom array property in XAML
body: <p>I am trying to populate a custom string array in XAML, but am receiving an error. I subclassed a ComboBox and added a string [] that I want to fill with custom values:</p>
  
  <pre><code>public class MyComboBox : ComboBox
  {
      public string[] MyProperty { get { return (string[])GetValue(MyPropertyProperty); } set { SetValue(MyPropertyProperty, value); } }
      public static readonly DependencyProperty MyPropertyProperty = DependencyProperty.Register("MyProperty", typeof(string[]), typeof(MyComboBox));
  }
  </code></pre>
  
  <p>My XAML is as follows:</p>
  
  <pre><code>&lt;Window x:Class="Samples.CustomArrayProperty"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          xmlns:local="clr-namespace:Samples"
          xmlns:sys="clr-namespace:System;assembly=mscorlib"
          Title="CustomArrayProperty" Height="300" Width="300"&gt;
      &lt;Grid&gt;
          &lt;local:MyComboBox Height="20"&gt;
              &lt;local:MyComboBox.MyProperty&gt;
                  &lt;sys:String&gt;Monday&lt;/sys:String&gt;
                  &lt;sys:String&gt;Wednesday&lt;/sys:String&gt;
                  &lt;sys:String&gt;Friday&lt;/sys:String&gt;
              &lt;/local:MyComboBox.MyProperty&gt;
          &lt;/local:MyComboBox&gt;
      &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p>When I run this, I get the error: "'Monday' is not a valid value for property 'MyProperty'.".</p>
  
  <p>What am I doing wrong?</p>