Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
FontFamilyProperty/FontWeightProperty different behaviour
Message
De
27/07/2009 13:48:25
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Windows Presentation Foundation (WPF)
Titre:
FontFamilyProperty/FontWeightProperty different behaviour
Versions des environnements
Environment:
C# 3.0
Divers
Thread ID:
01414817
Message ID:
01414817
Vues:
64
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
Répondre
Fil
Voir

Click here to load this message in the networking platform