Identifying Which Properties Are Dependency Properties
WPF has introduced a whole new category of properties called dependency properties. These are the "super properties". If you doubt that, here's a list of things that dependency properties can do in WPF:
... and more.
But not all properties in WPF are implemented as dependency properties. The Microsoft documentation gives you this method to find out:
"In the SDK reference, you can identify which property is a dependency property by the presence of the Dependency Property Information section on the managed reference page for that property."
Oh joy! Consult the SDK reference. Try to find a specific section and if it's there, then this must be a dependency property. Yeah, that'll work!
A (slightly) easier way is to check documentation for a property in MSDN. In my experience, it contains the notation, "This is a dependency property" as part of the formal definition. But there's an even easier way.
A more formal definition of a dependency property is: "A property that is backed by the WPF property system is known as a dependency property." What does "backed by the WPF property system" mean?
It means that another property exists that provides all that extra function. And there is a naming convention for them. The "backing property has the same name that ends with “Property”. For example, the ActualHeight is a dependency property and has a corresponding field named ActualHeightProperty.
Intellisense can pop that information right up! Here's a TextBox control with the standard Intellisense popup shown. Note that when the class is shown, only the WPF properties are displayed in the popup. When the instance is shown, all of the properties are displayed.
--------
Click Here to display the illustration
Click the Back button on your browser to return
--------
- Compute the value based on other inputs such as user preferences, data-binding, resources and styles, or values the program can find through parent-child relationships.
- provide self-contained validation
- have default values
- provide callbacks that monitor changes to other properties
- coerce property values based on runtime information
... and more.
But not all properties in WPF are implemented as dependency properties. The Microsoft documentation gives you this method to find out:
"In the SDK reference, you can identify which property is a dependency property by the presence of the Dependency Property Information section on the managed reference page for that property."
Oh joy! Consult the SDK reference. Try to find a specific section and if it's there, then this must be a dependency property. Yeah, that'll work!
A (slightly) easier way is to check documentation for a property in MSDN. In my experience, it contains the notation, "This is a dependency property" as part of the formal definition. But there's an even easier way.
A more formal definition of a dependency property is: "A property that is backed by the WPF property system is known as a dependency property." What does "backed by the WPF property system" mean?
It means that another property exists that provides all that extra function. And there is a naming convention for them. The "backing property has the same name that ends with “Property”. For example, the ActualHeight is a dependency property and has a corresponding field named ActualHeightProperty.
Intellisense can pop that information right up! Here's a TextBox control with the standard Intellisense popup shown. Note that when the class is shown, only the WPF properties are displayed in the popup. When the instance is shown, all of the properties are displayed.
--------
Click Here to display the illustration
Click the Back button on your browser to return
--------
Source...