13

Are there any articles that describe how the DependencyObject class in WPF works "under the hood"?

Specifically, I'm curious about how dependency properties are stored and accessed efficiently.

Tony the Pony
  • 40,327
  • 71
  • 187
  • 281
  • 1
    A good thing to Google is dependency properties sparse storage – RichardOD May 23 '11 at 21:41
  • 1
    Have a look here as well http://www.codeproject.com/Articles/140620/WPF-Tutorial-Dependency-Property – NoWar Jan 22 '13 at 13:44
  • Use a decompiler, you'll see the code. If you do not understand everything going on MSDN –  Oct 27 '15 at 12:01
  • There's a little bit of detail [here in this blog post](http://nirajrules.wordpress.com/2009/01/19/inside-dependencyobject-dependencyproperty/). That's all I can find though. – Tim May 23 '11 at 21:22
  • Also a TODO in [Mono](https://github.com/mono/mono/blob/master/mcs/class/WindowsBase/System.Windows/DependencyObject.cs) – Polluks Oct 12 '18 at 10:28

1 Answers1

12

As we know, a dependency property can be defined only on types that subclass DependencyObject. This base class defines a key value dictionary, that contains the local values of dependency properties.

When a dependency property is accessed, it's value is dynamically resolved (via the GetValue(dependencyproperty) in the .Net wrapper). For greater detail, check here: http://wpftutorial.net/DependencyProperties.html

Hasanain
  • 925
  • 8
  • 16