So I have created a User Control and I have created a dependency property on it TestProperty.
I want to have 2 instances of this User Control and set TestProperty to a different value for each instance.
<widgets:mycontrol Test="val1"></widgets:WTComboBox>
<widgets:mycontrol Test="val2"></widgets:WTComboBox>
If I create testproperty as a static DependencyProperty as follows:
public static readonly DependencyProperty TestProperty=
DependencyProperty.Register("Test", typeof(string), typeof(mycontrol), null);
in the control, then obviously I can't have a different value for it in each instance, but when I create testproperty as a normal instance property
public DependencyProperty TestProperty;
public mycontrol()
{
TestProperty = DependencyProperty.Register("Test", typeof(string), typeof(mycontrol), null);
}
on the control, then the designer doesn't recognise the property exists and creates an error, but at runtime the control works perfectly and each instance of the control has the right value for the test property.
So the question is how do I get instance dependencyproperty's to work in the designer?
Thanks