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

43 lines
1.3 KiB
C#
Raw Normal View History

// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
2024-02-03 21:01:53 +01:00
// Copyright © 2024 Clemens Fischer
// Licensed under the Microsoft Public License (Ms-PL)
using System.Collections.Generic;
2024-05-22 11:25:32 +02:00
#if WPF
using System.Windows;
2021-11-17 23:17:11 +01:00
#elif UWP
using Windows.UI.Xaml;
2024-05-22 11:25:32 +02:00
#elif WINUI
using Microsoft.UI.Xaml;
#endif
namespace MapControl
{
/// <summary>
/// A polygon defined by a collection of Locations.
/// </summary>
2024-05-26 09:49:00 +02:00
public class MapPolygon : MapPolypoint
{
2024-05-23 18:08:14 +02:00
public static readonly DependencyProperty LocationsProperty =
2024-05-23 18:22:52 +02:00
DependencyPropertyHelper.Register<MapPolygon, IEnumerable<Location>>(nameof(Locations), null,
2024-05-23 18:08:14 +02:00
(polygon, oldValue, newValue) => polygon.DataCollectionPropertyChanged(oldValue, newValue));
/// <summary>
/// Gets or sets the Locations that define the polygon points.
/// </summary>
2024-05-25 23:03:40 +02:00
#if WPF || AVALONIA
2021-06-14 21:41:37 +02:00
[System.ComponentModel.TypeConverter(typeof(LocationCollectionConverter))]
#endif
public IEnumerable<Location> Locations
{
2022-08-06 10:40:59 +02:00
get => (IEnumerable<Location>)GetValue(LocationsProperty);
set => SetValue(LocationsProperty, value);
}
protected override void UpdateData()
{
2024-05-26 09:49:00 +02:00
UpdateData(Locations, true);
}
}
}