2017-06-25 23:05:48 +02:00
|
|
|
|
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
|
2020-01-09 19:40:10 +01:00
|
|
|
|
// © 2020 Clemens Fischer
|
2012-11-23 16:16:09 +01:00
|
|
|
|
// Licensed under the Microsoft Public License (Ms-PL)
|
|
|
|
|
|
|
|
|
|
|
|
using System.Windows;
|
|
|
|
|
|
|
|
|
|
|
|
namespace MapControl
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class MapPanel
|
|
|
|
|
|
{
|
2019-07-08 23:00:57 +02:00
|
|
|
|
public static readonly DependencyProperty LocationProperty = DependencyProperty.RegisterAttached(
|
|
|
|
|
|
"Location", typeof(Location), typeof(MapPanel),
|
|
|
|
|
|
new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsParentArrange));
|
|
|
|
|
|
|
|
|
|
|
|
public static readonly DependencyProperty BoundingBoxProperty = DependencyProperty.RegisterAttached(
|
|
|
|
|
|
"BoundingBox", typeof(BoundingBox), typeof(MapPanel),
|
|
|
|
|
|
new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsParentArrange));
|
|
|
|
|
|
|
2013-04-12 19:59:16 +02:00
|
|
|
|
private static readonly DependencyPropertyKey ParentMapPropertyKey = DependencyProperty.RegisterAttachedReadOnly(
|
2019-07-08 23:00:57 +02:00
|
|
|
|
"ParentMap", typeof(MapBase), typeof(MapPanel),
|
|
|
|
|
|
new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.Inherits, ParentMapPropertyChanged));
|
2012-11-23 16:16:09 +01:00
|
|
|
|
|
2018-04-30 23:13:50 +02:00
|
|
|
|
private static readonly DependencyPropertyKey ViewportPositionPropertyKey = DependencyProperty.RegisterAttachedReadOnly(
|
|
|
|
|
|
"ViewportPosition", typeof(Point?), typeof(MapPanel), new PropertyMetadata());
|
|
|
|
|
|
|
2013-04-12 19:59:16 +02:00
|
|
|
|
public static readonly DependencyProperty ParentMapProperty = ParentMapPropertyKey.DependencyProperty;
|
2018-04-30 23:13:50 +02:00
|
|
|
|
public static readonly DependencyProperty ViewportPositionProperty = ViewportPositionPropertyKey.DependencyProperty;
|
2013-04-12 19:59:16 +02:00
|
|
|
|
|
2018-04-30 23:13:50 +02:00
|
|
|
|
public static MapBase GetParentMap(FrameworkElement element)
|
2012-11-23 16:16:09 +01:00
|
|
|
|
{
|
2017-09-05 20:57:17 +02:00
|
|
|
|
return (MapBase)element.GetValue(ParentMapProperty);
|
2012-11-23 16:16:09 +01:00
|
|
|
|
}
|
2013-04-12 19:59:16 +02:00
|
|
|
|
|
2017-09-05 20:57:17 +02:00
|
|
|
|
public static void InitMapElement(FrameworkElement element)
|
2013-04-12 19:59:16 +02:00
|
|
|
|
{
|
2017-09-05 20:57:17 +02:00
|
|
|
|
if (element is MapBase)
|
|
|
|
|
|
{
|
|
|
|
|
|
element.SetValue(ParentMapPropertyKey, element);
|
|
|
|
|
|
}
|
2013-04-12 19:59:16 +02:00
|
|
|
|
}
|
2018-04-30 23:13:50 +02:00
|
|
|
|
|
|
|
|
|
|
private static void SetViewportPosition(FrameworkElement element, Point? viewportPosition)
|
|
|
|
|
|
{
|
|
|
|
|
|
element.SetValue(ViewportPositionPropertyKey, viewportPosition);
|
|
|
|
|
|
}
|
2012-11-23 16:16:09 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|