XAML-Map-Control/MapControl/Shared/MapMultiPolygon.cs

40 lines
1.3 KiB
C#
Raw Normal View History

2025-02-27 18:46:32 +01:00
using System.Collections.Generic;
2024-07-16 21:29:25 +02:00
#if WPF
using System.Windows;
2024-07-16 21:29:25 +02:00
#elif UWP
using Windows.UI.Xaml;
#elif WINUI
using Microsoft.UI.Xaml;
#endif
2026-04-13 17:14:49 +02:00
namespace MapControl;
/// <summary>
/// A multi-polygon defined by a collection of collections of Locations.
/// Allows to draw filled polygons with holes.
///
/// A PolygonCollection (with ObservableCollection of Location elements) may be used
/// for the Polygons property if collection changes of the property itself and its
/// elements are both supposed to trigger UI updates.
/// </summary>
public partial class MapMultiPolygon : MapPolypoint
{
2026-04-13 17:14:49 +02:00
public static readonly DependencyProperty PolygonsProperty =
DependencyPropertyHelper.Register<MapMultiPolygon, IEnumerable<IEnumerable<Location>>>(nameof(Polygons), null,
(polygon, oldValue, newValue) => polygon.DataCollectionPropertyChanged(oldValue, newValue));
/// <summary>
2026-04-13 17:14:49 +02:00
/// Gets or sets the Locations that define the multi-polygon points.
/// </summary>
2026-04-13 17:14:49 +02:00
public IEnumerable<IEnumerable<Location>> Polygons
{
2026-04-13 17:14:49 +02:00
get => (IEnumerable<IEnumerable<Location>>)GetValue(PolygonsProperty);
set => SetValue(PolygonsProperty, value);
}
2026-04-13 17:14:49 +02:00
protected override void UpdateData()
{
UpdateData(Polygons);
}
}