Hi,
Don't know if I can explain this well enough but:
I have a sub-classed Canvas where I want to track FontFamily and FontWeight so I've added DependencyProperties using AddOwner():
private static readonly DependencyProperty FontFamilyProperty;
private static readonly DependencyProperty FontWeightProperty;
static LLCanvas
{
FontFamilyProperty = TextElement.FontFamilyProperty.AddOwner(typeof(LLCanvas));
FontWeightProperty = TextElement.FontWeightProperty.AddOwner(typeof(LLCanvas));
}
For testing I nest a couple of these inside a third instance.
If I set the TextWeight on one of these instances it works impecably - drag in, say, a TextBlock and it picks up the setting, drag it out and it reverts to the setting for the outer container.
But if I set the TextFamily property I get odd results. If I drag in a TextBlock then it picks up the font as expected - but from that point the BaseValueSource for his property is no longer 'Inherited' but 'Local' so when I drag it back out the FontFamily is fixed.
I've read that AddOwner() doesn't inherit Metadata from the 'source' DependencyProperty so I also tried this adding new Metadata with Inherits=true but this made no difference.
IAC, why would this work with FontWeightProperty but not with FontFamilyProperty?
TIA,
Viv