What is the Dependency property in WPF

拟墨画扇 提交于 2020-01-03 04:16:27

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!