开发者

WPF - Updating DependencyProperty Metadata

开发者 https://www.devze.com 2022-12-13 11:52 出处:网络
What is the technica开发者_Go百科l reason for not being able to update a DependencyProperty\'s metadata after it has already been set?

What is the technica开发者_Go百科l reason for not being able to update a DependencyProperty's metadata after it has already been set?

If you try to do something similar to below it will generate an exception saying:

Cannot change property metadata after it has been associated with a property.

MyProperty.DefaultMetata.PropertyChangedCallback = 
    new PropertyChangedCallback(MyMethod);


Immutable objects have many benefits, one of which is thread-safety.

Also, metadata exists on a per-type basis; setting PropertyChangedCallback directly would effectively erase all other callbacks in the inheritance hierarchy.


Does this question from Stackoverflow help any. WPF Property Callback

If that doesn't help. What do you mean by set, set in vs2k8 dev or set in the dll.

0

精彩评论

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

关注公众号