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

How/where best to wire and unwire event handlers in custom renderers?

$
0
0

For my ContentPages, I wire up event handlers in OnAppearing and unwire them in OnDisappearing.

I am just browsing through the various custom renderers that I have (initially for iOS, will check others shortly). They wire up event handlers in OnElementChanged, but some do the unwiring in OnElementChanged (if OldElement != null and Control != null) and some do it in Dispose.

What is considered best practice (I prefer symmetrical stuff like OnAppearing and OnDisappearing, so it may be using OnElementChanged for both is the closest to symmetrical, but are there better options?


Viewing all articles
Browse latest Browse all 77050

Trending Articles



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