Any way to un-register a WPF dependency property?

后端 未结 6 1280
天命终不由人
天命终不由人 2020-12-16 20:14

I\'m running into an unusual problem in my unit tests. The class I\'m testing creates a dependency property dynamically at runtime and the type of that dependency property c

6条回答
  •  抹茶落季
    2020-12-16 20:19

    I don't think you can un-register a dependency property but you can redefine it by overriding the metadata like this:

    MyDependencyProperty.OverrideMetadata(typeof(MyNewType), 
                         new PropertyMetadata());
    

提交回复
热议问题