>>If the answer is yes, then I'm going to have to rethink the rest of this.
>
>Yes. If any element above it in the visual tree is locked then it should be locked. If no element above is locked it should revert to its own locked state.
>
>The docs say that you CAN use DepenendencyProperty.Register() where metadata specifies inheritance but the behaviour is undefined.
>One obvious difference is that with RegisterAttached() callbacks are raised on all elements in the visual tree. Using .Register() this doesn't happen.....
>
>I guess I still have stuff to learn about dependency properties - but I'm more comfortable now than I was a couple of days ago....
>
>Best,
>Viv
OK, now that I fully understand what your doing. Readonly and a second DP do not make sense for this.
Did this end up working?
private static object CoerceIsLocked(DependencyObject d, object value)
{
if (d.ReadLocalValue(ContentIsLockedProperty) == DependencyProperty.UnsetValue)
return value;
bool b = (bool)value;
if (b)
return b;
else
return DependencyProperty.UnsetValue;
}
This is interesting, I'm coding a test project just to play with this. There are so many possible side effects depending on order of execution etc, that I can't think with it in my head.