Skip to content

Instantly share code, notes, and snippets.

@rotorgames
Created December 22, 2019 08:18
Show Gist options
  • Select an option

  • Save rotorgames/8210e771ae495d1880aa2719185be864 to your computer and use it in GitHub Desktop.

Select an option

Save rotorgames/8210e771ae495d1880aa2719185be864 to your computer and use it in GitHub Desktop.
public TestView : View
{
private static void OnItemSourceChanged(BindableObject bindable, object oldvalue, object newvalue)
{
var self = (TestView) bindable;
var oldCollection = oldvalue as INotifyCollectionChanged;
var newCollection = newvalue as INotifyCollectionChanged;
if (oldCollection != null)
oldCollection.CollectionChanged -= self.OnItemSourceCollectionChanged;
if (newCollection != null)
newCollection.CollectionChanged += self.OnItemSourceCollectionChanged;
self.UpdateItems(); // your custom method
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment