2017-06-25 23:05:48 +02:00
|
|
|
|
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
|
2021-01-13 21:19:27 +01:00
|
|
|
|
// © 2021 Clemens Fischer
|
2012-11-23 16:16:09 +01:00
|
|
|
|
// Licensed under the Microsoft Public License (Ms-PL)
|
|
|
|
|
|
|
2017-09-05 20:57:17 +02:00
|
|
|
|
#if WINDOWS_UWP
|
2021-01-11 22:35:17 +01:00
|
|
|
|
using Windows.UI.Xaml;
|
2012-12-06 23:28:12 +01:00
|
|
|
|
using Windows.UI.Xaml.Controls;
|
2017-09-05 20:57:17 +02:00
|
|
|
|
#else
|
2021-01-11 22:35:17 +01:00
|
|
|
|
using System.Windows;
|
2017-09-05 20:57:17 +02:00
|
|
|
|
using System.Windows.Controls;
|
|
|
|
|
|
#endif
|
2012-12-06 23:28:12 +01:00
|
|
|
|
|
2012-11-23 16:16:09 +01:00
|
|
|
|
namespace MapControl
|
|
|
|
|
|
{
|
2012-12-06 23:28:12 +01:00
|
|
|
|
/// <summary>
|
2021-01-11 22:35:17 +01:00
|
|
|
|
/// Pushpin at a geographic location specified by the Location property.
|
2012-12-06 23:28:12 +01:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public class Pushpin : ContentControl
|
2012-11-23 16:16:09 +01:00
|
|
|
|
{
|
2021-01-11 22:35:17 +01:00
|
|
|
|
#if WINDOWS_UWP
|
2021-01-13 00:08:55 +01:00
|
|
|
|
public static readonly DependencyProperty AutoCollapseProperty = DependencyProperty.Register(
|
|
|
|
|
|
nameof(AutoCollapse), typeof(bool), typeof(Pushpin),
|
|
|
|
|
|
new PropertyMetadata(false, (o, e) => MapPanel.SetAutoCollapse((FrameworkElement)o, (bool)e.NewValue)));
|
|
|
|
|
|
|
|
|
|
|
|
public static readonly DependencyProperty LocationProperty = DependencyProperty.Register(
|
|
|
|
|
|
nameof(Location), typeof(Location), typeof(Pushpin),
|
|
|
|
|
|
new PropertyMetadata(null, (o, e) => MapPanel.SetLocation((FrameworkElement)o, (Location)e.NewValue)));
|
2021-01-11 22:35:17 +01:00
|
|
|
|
#else
|
2021-01-13 00:08:55 +01:00
|
|
|
|
public static readonly DependencyProperty AutoCollapseProperty = MapPanel.AutoCollapseProperty.AddOwner(typeof(Pushpin));
|
|
|
|
|
|
|
|
|
|
|
|
public static readonly DependencyProperty LocationProperty = MapPanel.LocationProperty.AddOwner(typeof(Pushpin));
|
2021-01-11 22:35:17 +01:00
|
|
|
|
#endif
|
2012-11-23 16:16:09 +01:00
|
|
|
|
public Pushpin()
|
|
|
|
|
|
{
|
|
|
|
|
|
DefaultStyleKey = typeof(Pushpin);
|
2016-08-08 20:36:02 +02:00
|
|
|
|
|
2017-09-05 20:57:17 +02:00
|
|
|
|
MapPanel.InitMapElement(this);
|
2016-08-08 20:36:02 +02:00
|
|
|
|
}
|
2018-02-09 17:43:47 +01:00
|
|
|
|
|
2021-01-13 00:08:55 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Wrapper for the MapPanel.AutoCollapse attached property.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool AutoCollapse
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return (bool)GetValue(AutoCollapseProperty); }
|
|
|
|
|
|
set { SetValue(AutoCollapseProperty, value); }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Wrapper for the MapPanel.Location attached property.
|
|
|
|
|
|
/// </summary>
|
2018-02-09 17:43:47 +01:00
|
|
|
|
public Location Location
|
|
|
|
|
|
{
|
2021-01-11 22:35:17 +01:00
|
|
|
|
get { return (Location)GetValue(LocationProperty); }
|
|
|
|
|
|
set { SetValue(LocationProperty, value); }
|
2018-02-09 17:43:47 +01:00
|
|
|
|
}
|
2012-11-23 16:16:09 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|