title: Setting a collection DependencyProperty from XAML (WPF)
body: <p>I created a user control (<code>FilterPicker</code>), that has a certain list as a property. This is a dependency property so that it can be set when I use the user control.</p>
  
  <pre><code>public static readonly DependencyProperty StrategiesProperty = DependencyProperty.Register(
          "Strategies",
          typeof(List&lt;FilterType&gt;),
          typeof(FilterPicker),
          new FrameworkPropertyMetadata
          {
              DefaultValue = new List&lt;FilterType&gt; { FilterType.Despike },
              PropertyChangedCallback = StrategiesChangedCallback,
              BindsTwoWayByDefault = false,
          });
  </code></pre>
  
  <p>I am then trying to define this list in the .xaml file where I use this control.</p>
  
  <pre><code>&lt;Filtering:FilterPicker Grid.Row="1" Strategy="{Binding Strategy}"&gt;
              &lt;Filtering:FilterPicker.Strategies&gt;
                  &lt;Filtering1:FilterType&gt;PassThrough&lt;/Filtering1:FilterType&gt;
                  &lt;Filtering1:FilterType&gt;MovingAverage&lt;/Filtering1:FilterType&gt;
                  &lt;Filtering1:FilterType&gt;Despike&lt;/Filtering1:FilterType&gt;
              &lt;/Filtering:FilterPicker.Strategies&gt;
          &lt;/Filtering:FilterPicker&gt;
  </code></pre>
  
  <p>However, it doesn't work. <code>StrategiesChangedCallBack</code> never gets called.
  If I set it through a binding, it works fine - just not when I try to define it in the xaml. So this works:</p>
  
  <pre><code>&lt;Filtering:FilterPicker Grid.Row="1" Strategy="{Binding Strategy}" Strategies="{Binding AllStrategies}"&gt;
  </code></pre>
  
  <p>But not the previous snippet. Any ideas on what I'm doing wrong?</p>