This commit is contained in:
ClemensF 2020-04-16 23:15:03 +02:00
parent 3ffb613f80
commit 310f0cca9a
21 changed files with 51 additions and 86 deletions

View file

@ -35,16 +35,14 @@ namespace MapControl
protected void DataCollectionPropertyChanged(DependencyPropertyChangedEventArgs e)
{
INotifyCollectionChanged collection;
if ((collection = e.OldValue as INotifyCollectionChanged) != null)
if (e.OldValue is INotifyCollectionChanged oldCollection)
{
CollectionChangedEventManager.RemoveListener(collection, this);
CollectionChangedEventManager.RemoveListener(oldCollection, this);
}
if ((collection = e.NewValue as INotifyCollectionChanged) != null)
if (e.NewValue is INotifyCollectionChanged newCollection)
{
CollectionChangedEventManager.AddListener(collection, this);
CollectionChangedEventManager.AddListener(newCollection, this);
}
UpdateData();