mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-05-07 13:37:47 +00:00
MapMultiPolygon
This commit is contained in:
parent
5b9ad68c57
commit
dbd32361b5
11 changed files with 217 additions and 61 deletions
|
|
@ -27,9 +27,9 @@ namespace MapControl
|
|||
|
||||
protected override void InsertItem(int index, IEnumerable<Location> polygon)
|
||||
{
|
||||
if (polygon is INotifyCollectionChanged observablePolygon)
|
||||
if (polygon is INotifyCollectionChanged addedPolygon)
|
||||
{
|
||||
CollectionChangedEventManager.AddListener(observablePolygon, this);
|
||||
CollectionChangedEventManager.AddListener(addedPolygon, this);
|
||||
}
|
||||
|
||||
base.InsertItem(index, polygon);
|
||||
|
|
@ -37,9 +37,14 @@ namespace MapControl
|
|||
|
||||
protected override void SetItem(int index, IEnumerable<Location> polygon)
|
||||
{
|
||||
if (this[index] is INotifyCollectionChanged observablePolygon)
|
||||
if (this[index] is INotifyCollectionChanged removedPolygon)
|
||||
{
|
||||
CollectionChangedEventManager.RemoveListener(observablePolygon, this);
|
||||
CollectionChangedEventManager.RemoveListener(removedPolygon, this);
|
||||
}
|
||||
|
||||
if (polygon is INotifyCollectionChanged addedPolygon)
|
||||
{
|
||||
CollectionChangedEventManager.AddListener(addedPolygon, this);
|
||||
}
|
||||
|
||||
base.SetItem(index, polygon);
|
||||
|
|
@ -47,9 +52,9 @@ namespace MapControl
|
|||
|
||||
protected override void RemoveItem(int index)
|
||||
{
|
||||
if (this[index] is INotifyCollectionChanged observablePolygon)
|
||||
if (this[index] is INotifyCollectionChanged removedPolygon)
|
||||
{
|
||||
CollectionChangedEventManager.RemoveListener(observablePolygon, this);
|
||||
CollectionChangedEventManager.RemoveListener(removedPolygon, this);
|
||||
}
|
||||
|
||||
base.RemoveItem(index);
|
||||
|
|
@ -57,9 +62,9 @@ namespace MapControl
|
|||
|
||||
protected override void ClearItems()
|
||||
{
|
||||
foreach (var observablePolygon in this.OfType<INotifyCollectionChanged>())
|
||||
foreach (var polygon in this.OfType<INotifyCollectionChanged>())
|
||||
{
|
||||
CollectionChangedEventManager.RemoveListener(observablePolygon, this);
|
||||
CollectionChangedEventManager.RemoveListener(polygon, this);
|
||||
}
|
||||
|
||||
base.ClearItems();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue