Any way to un-register a WPF dependency property?

后端 未结 6 1285
天命终不由人
天命终不由人 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:41

    If we register name for a Label like this :

    Label myLabel = new Label();
    this.RegisterName(myLabel.Name, myLabel);
    

    We can easily unregister the name by using :

    this.UnregisterName(myLabel.Name);
    

提交回复
热议问题