Should we really Unsubscribe from all events onDisappearing?

Which events should we unsubscribe in order to avoid memory leaks. For example i have sflistview in my xaml? it has ItemHolding event, Should I unsubscribe in OnDisappearing method? if yes, that means that it makes no sense to define in xaml, as it will be created through constructor, so it is better to use it in OnAppearing method? Can somebody please confirm the best way to work with such events? SfListView is example, same question goes for all Syncfusion xamarin tools.

      <sfListView:SfListView x:Name="list"    ItemHolding="listSets_ItemHolding"        

1 Reply

MK Muthu Kumaran Gnanavinayagam Syncfusion Team December 12, 2017 11:09 AM UTC

Hi Emil, 
  
We would like to enlighten you that when event is hooked from XAML page, it will be automatically unsubscribed when object get disposed. And when you subscribe the event in code behind (for e.g., OnAppearing method), then you need to unsubscribe it in OnDisappearing override method. This is common for all our controls.  
 
Still, if you are facing any memory leak issues in any of our controls, then please share the more details about the issues along with control name? 
  
Regards, 
G.Muthu Kumaran. 


Loader.
Up arrow icon