DependencyProperty as instance-variables?

后端 未结 1 1120
执笔经年
执笔经年 2021-01-15 20:34

While most code samples around the net use a static declaration of DependencyProperties, I found in some cases they are defined as public readonly instance members.

<
1条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-15 21:16

    That is not quite a good idea. As soon as there is more than one instance of the control an exception should be thrown as the same property is being registered again and the registration is per-type and not per-instance.

    'X' property was already registered by 'Y'.

    Possibly a slip by the coder in the cases you encountered.

    0 讨论(0)
提交回复
热议问题