0

What is the technical 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);
Dave Clemmer
  • 3,741
  • 12
  • 49
  • 72
Taylor Leese
  • 51,004
  • 28
  • 112
  • 141

2 Answers2

1

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.

Bryan Watts
  • 44,911
  • 16
  • 83
  • 88
0

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.

Community
  • 1
  • 1
scope_creep
  • 4,213
  • 11
  • 35
  • 64