开发者

DependencyProperty as instance-variables?

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.

Are there any pros in defining a DependencyProperty as an instance-member (and not static)?

(Note: I dont want to get in the question of whether or not static members are good or b开发者_高级运维ad, rather more specifically on the behaviour of the DependencyProperty object)


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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜