Saturday, 11 February 2012

What are DEPENDENCY properties in Silverlight?

Remember, that Silverlight is a mere microcosm of a bigger library known as the behemoth WPF. So when we discuss the Silverlight property system what we are really talking about it just a small subset of what might be known as the "WPF" property system. So there you go.

The Silverlight property system (TM) provides ways to EXTEND the CLR PROPERTY SYSTEM. You all heard that, right? We are EXTENDING THE CLR PROPERTY SYSTEM. Great. A dependency property is, quite simply, a property that is backed by the SL property system is most appreciatingly known as a DEPENDENCY PROPERTY.

Dependency properties, as their name suggests, are fundamentally about dependencies. We want a property to AUTO-COMPUTE based on the value of other properties. In this way, we might think of dependency properties, as nothing more than the oh-so-ordinary appellation called "dependent" properties, but we call them more fancy names, like "dependency" properties. "Dependency" does sound a lot cooler than "dependent".

Some rules of the game: a dependency property must be on a DependencyObject. They are usually public static and readonly members.

No comments: