Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

Disposing ViewCells

$
0
0

Hi,

in my custom ViewCell I have a complex BindableProperty that also has some event handlers. In the propertyChanged and propertyChanging delegates I wire/unwire those event handlers but the unwiring does never happen, which of course leads to memory leaks.
So my idea was to wire in OnAppearing and unwire in OnDisappearing, which doesn't really help either as OnDisappearing isn't called for every cell when I navigate back for example.
What would be a good workaround, or is there anything I can override from the ViewCell that gets called when the cell is disposed? Maybe a reset of the binding context?
(I can't change my ViewModel itself, and also can't remove the event handlers).

Thanks and all the best, Roland


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>