c# - WPF user control not being disposed -


each time open view number of get requests each of model properties increment one. clear if open view once, close , open again there 2 get requests each property, , if property set , raisepropertychanged("propertname") triggered there 2 get requests again. number of get requests equal number of times view has been instantiated! have debugged life out of issue , points towards being user controls aren't being disposed of when view closed , bindings withheld.

what should deal this? have looked disposal of user controls have been unsuccessful in finding me fix this. maybe not looking right topic? or pointers appreciated - thanks!

wpf controls not implement idisposable and, hence, don't need disposed of. believe want "is not being marked eligible garbage collection"

it seems problem related called event reference. of living instance (some class have not window/user control) retains reference event. if if close window or usercontrol link still lives on , not cleared automatically.

when closing window/user control should dereference event this

eventname-= methodhandler or this.usercontrolinstance=null

you may read interesting pattern here


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -