I craeted a dependency property that is an array of dependency properties. I would like to add values in xaml in this way:
<z:Zoomable.UnScale>
<x:Static Member="Rectangle.StrokeThicknessProperty" ></x:Static>
<x:Static Member="Ellipse.StrokeThicknessProperty"></x:Static>
</z:Zoomable.UnScale>
but it complains with this error:
‘StrokeThickness’ is not a valid value for property ‘UnScale’.
The property is defined in this way:
public static readonly DependencyProperty UnScaleProperty =
DependencyProperty.RegisterAttached("UnScale", typeof(ObservableCollection<DependencyProperty>), typeof(Zoomable), new UIPropertyMetadata(GetPropertyCollection(), new PropertyChangedCallback(OnUnscaledChanged)));
I suspect there is some problem in using the StaticExtension, because if I try to add a DepenedencyPropery in pure xaml it works ( although it does not work because there is not empty constructor ). Another odd thing: if I declare the property as an observable collection of object and I add a dummy object in the first place it works! ie:
<z:Zoomable.UnScale>
<Button> Any object here </Button>
<x:Static Member="Rectangle.StrokeThicknessProperty" ></x:Static>
<x:Static Member="Ellipse.StrokeThicknessProperty"></x:Static>
</z:Zoomable.UnScale>
It tries to SET the property to given object instead of adding items to the collection. So, you should be doing something like this:
Where
z:DependencyPropertyCollectionis: