开发者

WPF - Updating DependencyProperty Metadata

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜