mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-06 23:15:14 +00:00
Updated MapPolypoint and PolygonCollection
This commit is contained in:
parent
81707c8ac0
commit
f86f1d3c28
6 changed files with 64 additions and 197 deletions
|
|
@ -1,58 +1,16 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
#if UWP
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Media;
|
||||
#else
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Media;
|
||||
#endif
|
||||
|
||||
namespace MapControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class of MapPolyline and MapPolygon.
|
||||
/// </summary>
|
||||
public partial class MapPolypoint : MapPath
|
||||
{
|
||||
public static readonly DependencyProperty FillRuleProperty =
|
||||
DependencyPropertyHelper.Register<MapPolygon, FillRule>(nameof(FillRule), FillRule.EvenOdd,
|
||||
(polypoint, oldValue, newValue) => ((PathGeometry)polypoint.Data).FillRule = newValue);
|
||||
|
||||
public FillRule FillRule
|
||||
{
|
||||
get => (FillRule)GetValue(FillRuleProperty);
|
||||
set => SetValue(FillRuleProperty, value);
|
||||
}
|
||||
|
||||
protected MapPolypoint()
|
||||
{
|
||||
Data = new PathGeometry();
|
||||
}
|
||||
|
||||
protected void DataCollectionPropertyChanged(IEnumerable oldValue, IEnumerable newValue)
|
||||
{
|
||||
if (oldValue is INotifyCollectionChanged oldCollection)
|
||||
{
|
||||
oldCollection.CollectionChanged -= DataCollectionChanged;
|
||||
}
|
||||
|
||||
if (newValue is INotifyCollectionChanged newCollection)
|
||||
{
|
||||
newCollection.CollectionChanged += DataCollectionChanged;
|
||||
}
|
||||
|
||||
UpdateData();
|
||||
}
|
||||
|
||||
protected void DataCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
UpdateData();
|
||||
}
|
||||
|
||||
protected void UpdateData(IEnumerable<Location> locations, bool closed)
|
||||
{
|
||||
var figures = ((PathGeometry)Data).Figures;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue