You need dependency properties to plug into core WPF
features, such as animation, data binding, and styles.
Most of the properties that are exposed by WPF elements are dependency properties. In
all the examples you??™ve seen up to this point, you??™ve been using dependency properties without
realizing it. That??™s because dependency properties are designed to be consumed in the
same way as normal properties.
139
C H A P T E R 6
140 CHAPTER 6 n DEPENDENCY PROPERTIES AND ROUTED EVENTS
However, dependency properties are not normal properties. It??™s comforting to think of a
dependency property as a normal property (defined in the typical .NET fashion) with a set of
WPF features added on. Conceptually, dependency features behave this way, but that??™s not
how they??™re implemented behind the scenes. The simple reason why is performance. If the
designers of WPF simply added extra features on top of the .NET property system, they??™d need
to create a complex, bulky layer for your code to travel through. Ordinary properties could not
support all the features of dependency properties without this extra overhead.
Dependency properties are a WPF-specific creation. However, the dependency properties
in the WPF libraries are always wrapped by ordinary .NET property procedures. This makes
them usable in the normal way, even with code that has no understanding of the WPF
dependency property system.
Pages:
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285