Jonathan Allen
Jonathan Allen

Reputation: 70327

WPF/Silverlight: Attached Properties and Garbage Collection

Lets say I've got a textbox and an attached property called Foo.Bar.

<Textbox local:Foo.Bar="5" />

Does the attached property hold a strong reference to the textbox?

Upvotes: 2

Views: 215

Answers (1)

kowd
kowd

Reputation: 426

No they should not, you can think of DependencyObejcts as dictionaries and of Dependency / Attached properties as keys in the dictionary.

The OnBarChanged can do whatever it wants with the TextBox though, it could potentially keep a strong reference to it somewhere.

Upvotes: 3

Related Questions