Dependency property values โโare stored inside objects (derived from DependencyObject) to which we apply the property value.
Take your attached TextElement.FontSizeProperty property, for example:
<StackPanel TextElement.FontSize="20" ... > ... </StackPanel>
XAML parser translates it to the following:
... TextElement.SetFontSize(stackPanel, 20); ...
which internally:
public static void SetFontSize(DependencyObject element, double value) { element.SetValue(TextElement.FontSizeProperty, value); }
So setting TextElement.FontSize on the stackPanel is the same as calling
stackPanel.SetValue(TextElement.FontSizeProperty, value)
SetValue () is a method defined in the DependencyObject class. Many complex things happen inside the method, but in the end, the effective value of the dependency property is wrapped in a structure called EffectiveValueEntry and stored in the following instance field inside DependencyObject:
private EffectiveValueEntry[] _effectiveValues;
source share