I'm a little bit unclear with all this magic. As I understood dependency properties get inherited from the DependencyObject, so values are stored:
- in the instance itself if value is assigned (in the local dictionary)
or taken from the link to a parent element if value is not specified.
protected object GetValue(string propertyName) { if (LocalValues.ContainsKey(propertyName)) { return LocalValues[propertyName]; } return Parent.GetValue(propertyName); }
Am I correct in this?
I also don't understand where are values for attached properties stored?
Control.FontSizeProperty = TextElement.FontSizeProperty.AddOwner(
typeof(Control), new FrameworkPropertyMetadata(SystemFonts.MessageFontSize,
FrameworkPropertyMetadataOptions.Inherits));
Does AddOwner method call on Attached property assigns value to the instance field? When does this happen and where does the value go?
Thanks!