Wenfengcheng / xamarin-notes

xamarin journal
MIT License
3 stars 0 forks source link

Disposing of observers and resources in Xamarin.Forms #45

Open Wenfengcheng opened 5 years ago

Wenfengcheng commented 5 years ago

OnElementChanged is called twice - when control is created and then when disposed.

if(e.NewElement != null)
      addobserver and do other stuff
if(e.oldElement!=null)
       remove observer and destroy everything you allocated