title: WPF: Cannot set items of a read-only collection in XAML
body: <p>The scenario is really simple. I have a read-only collection property of my custom control, and I want set the items of the collection in XAML. Like this:</p>
  
  <pre><code>&lt;l:CustomControl&gt;
     &lt;l:CustomControl.ControlItems&gt;
       &lt;l:CustomItem /&gt;
       &lt;l:CustomItem /&gt;
    &lt;/l:CustomControl.ControlItems&gt;
  &lt;/l:CustomControl&gt;
  </code></pre>
  
  <p>The <code>ControlItems</code> property has <code>internal set</code> and <code>public get</code> accessors, and is of type <code>FreezableCollection&lt;CustomItem&gt;</code>. </p>
  
  <p>The thing is that I am getting build errors that say this is not possible because my <code>ControlItems</code> property does not have an accessable <code>set</code> accessor.</p>
  
  <p>As I know, this scenario is supported in WPF (as of .NET3.5SP1). Am I wrong? What might be the problem? This works with <code>Grid.RowDefinitions</code>, I tried adding the <code>DesignerSerializationVisibility</code> attribute but it did not work.</p>
  
  <p>Edit: I noticed that I receive this error only when I have an <code>internal</code>, <code>private</code> or <code>protected</code> set accessor. When I completely remove the accessor, everything builds fine.</p>