Created
October 23, 2014 16:55
-
-
Save JohanLarsson/8d16511744e5fdc0b5e0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| protected static void OnMyCollectionItemsSourceChanged(DependencyObject property, DependencyPropertyChangedEventArgs args) | |
| { | |
| var newCol = args.NewValue as INotifyCollectionChanged; | |
| if (newCol != null) | |
| { | |
| // CollectionChangedEventManager.AddListener(newCol, this); // You probably wanna do this in a control | |
| newCol.CollectionChanged += OnCollectionChanged; | |
| } | |
| var oldCol = args.OldValue as INotifyCollectionChanged; | |
| if (oldCol != null) | |
| { | |
| //CollectionChangedEventManager.RemoveListener(oldCol, this); // | |
| oldCol.CollectionChanged -= OnCollectionChanged; | |
| } | |
| } | |
| private static void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs notifyCollectionChangedEventArgs) | |
| { | |
| System.Diagnostics.Debug.WriteLine("MyCollection Updated"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment