I read this in the following link:-
http://www.informit.com/articles/article.aspx?p=688529&seqNum=2
However, because GetValue and SetValue internally use an efficient sparse storage system and because IsDefaultProperty is a static field (rather than an instance field), the dependency property implementation saves per-instance memory compared to a typical .NET property. If all the properties on WPF controls were wrappers around instance fields (as most .NET properties are), they would consume a significant amount of memory because of all the local data attached to each instance.
But eventually they are getting stored somewhere, how does it saves memory consumption ?
See the following link: Dependency Properties.
As long as a Dependency Property uses its default state (which is very common), it won’t take up any additional memory since the default value will be used. The default value isn’t stored per instance, it is stored per Dependency Property and it’s set by metadata.
Example, notice how
Brushes.Blackis set as the default valueThink of it this way: Say you have four
TextBlocksin XamlThe three
TextBlocksat the top haveForegroundset to Black although you have never explicitly set it to Black. They are using their default value. So for theForegroundproperty for the threeTextBlocksabove, you only need one field (since it is a static field).For the forth
TextBlockthough, you have explicitly setForegroundto Green, so that value is inserted into a dictionary as the local value forForegroundon this instance and thus requires additional memory (also, it will end up at place number 3 in the list below, overridingSetters,Triggersetc).Also, see the following post by Josh Smith, it’s a good read: Demystifying dependency properties
Edit: To answer the comment from Duane
If you explicitly set the value to the same value as the default value, it will still get stored as the local value. This can easily be verified with the following Xaml.
Both
TextBlockswill haveForegroundset to Black, but the later has a local value set. TheStylewill only be able to setForegroundon the firstTextBlockand not the later since Style setters has lower priority than local value.