Why .Net WPF DependencyProperties Must Be Static Class Members

WPF training now. Today I found something new with .Net dependency properties. What do they bring to the table

  • Callback support (check, change, etc.)
  • Property Inheritance
  • Attached Properties

among the others.

But my question here is why should they be declared as static in the containing class? The recommended way is then to add an instance property of 'wrapper' for them. Why?

edit: @Matt, but doesn't that mean that the value of the property is also shared between instances - unless, of course, this is a derived value?

+3
source share
3 answers

I see two reasons for this requirement:

  • DP . , , , DP.
  • DP ( )
+2

- WPF. WPF , . . DP - , . DP , WPF .

, DP, , WPF , , , , , .

+7

, , , , . - , (, ) .., , , - . , .

+5

Source: https://habr.com/ru/post/1696610/


All Articles