Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
FontFamilyProperty/FontWeightProperty different behaviour
Message
From
27/07/2009 13:48:25
 
 
To
All
General information
Forum:
ASP.NET
Category:
Windows Presentation Foundation (WPF)
Title:
FontFamilyProperty/FontWeightProperty different behaviour
Environment versions
Environment:
C# 3.0
Miscellaneous
Thread ID:
01414817
Message ID:
01414817
Views:
65
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
Reply
Map
View

Click here to load this message in the networking platform