XAML-Map-Control/MapControl/Shared/MapPolyline.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)
2017-08-04 21:38:58 +02:00
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 polyline defined by a collection of Locations.
/// </summary>
2024-05-26 09:49:00 +02:00
public class MapPolyline : MapPolypoint
{
2024-05-23 18:08:14 +02:00
public static readonly DependencyProperty LocationsProperty =
2024-05-23 18:22:52 +02:00
DependencyPropertyHelper.Register<MapPolyline, IEnumerable<Location>>(nameof(Locations), null,
2024-05-23 18:08:14 +02:00
(polyline, oldValue, newValue) => polyline.DataCollectionPropertyChanged(oldValue, newValue));
2017-08-04 21:38:58 +02:00
/// <summary>
/// Gets or sets the Locations that define the polyline points.
2017-08-04 21:38:58 +02:00
/// </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
2017-08-04 21:38:58 +02:00
public IEnumerable<Location> Locations
{
2022-08-06 10:40:59 +02:00
get => (IEnumerable<Location>)GetValue(LocationsProperty);
set => SetValue(LocationsProperty, value);
2017-08-04 21:38:58 +02:00
}
protected override void UpdateData()
{
2024-05-26 09:49:00 +02:00
UpdateData(Locations, false);
}
}
}