Need a short and clear definition for “Dependency Properties”

前端 未结 6 860
没有蜡笔的小新
没有蜡笔的小新 2021-02-02 13:42

I\'m trying to figure out what exactly Dependency Properties are, but when I look anywhere for a definition, I only find \"how to use\" but not \"what it is\". Imagine you are

6条回答
  •  旧时难觅i
    2021-02-02 14:28

    A dependency property depends on multiple providers for determining its value at any point in time. These providers could be an animation continuously changing its value, a parent element whose property value propagates down to its children, and so on.

    Arguably the biggest feature of a dependency property is its built-in ability to provide change notification.

    Whenever the value of a dependency property changes, WPF can automatically trigger a number of actions, depending on the property’s metadata. These actions can be re-render- ing the appropriate elements, updating the current layout, refreshing data bindings, and much more. One of the most interesting features enabled by this built-in change notifica- tion is property triggers, which enable you to perform your own custom actions when a property value changes, without writing any procedural code

提交回复
热议问题