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:
<l:CustomControl>
<l:CustomControl.ControlItems>
<l:CustomItem />
<l:CustomItem />
</l:CustomControl.ControlItems>
</l:CustomControl>
The ControlItems property has internal set and public get accessors, and is of type FreezableCollection<CustomItem>.
The thing is that I am getting build errors that say this is not possible because my ControlItems property does not have an accessable set accessor.
As I know, this scenario is supported in WPF (as of .NET3.5SP1). Am I wrong? What might be the problem? This works with Grid.RowDefinitions, I tried adding the DesignerSerializationVisibility attribute but it did not work.
Edit: I noticed that I receive this error only when I have an internal, private or protected set accessor. When I completely remove the accessor, everything builds fine.