问题
What is the Dependency property in WPF and Silverlight.
Why we required and where we can use it.
Thanks...
回答1:
From the documentation:
The purpose of dependency properties is to provide a way to compute the value of a property based on the value of other inputs. These other inputs might include system properties such as themes and user preference, just-in-time property determination mechanisms such as data binding and animations/storyboards, multiple-use templates such as resources and styles, or values known through parent-child relationships with other elements in the element tree.
So they're like normal properties, but their value can be automatically computed from the values of other properties.
回答2:
There is a good article on dependency properties here:
http://www.betterthaneveryone.com/archive/2010/01/24/wpf-silverlight-xaml-and-dependency-properties.aspx
来源:https://stackoverflow.com/questions/3977378/what-is-the-dependency-property-in-wpf