2025-02-27 18:46:32 +01:00
|
|
|
|
using System.Collections.Generic;
|
2024-05-31 22:45:05 +02:00
|
|
|
|
|
2024-05-19 23:23:27 +02:00
|
|
|
|
namespace MapControl
|
|
|
|
|
|
{
|
2024-05-20 23:24:34 +02:00
|
|
|
|
public partial class MapPanel
|
2024-05-19 23:23:27 +02:00
|
|
|
|
{
|
2024-05-27 11:05:22 +02:00
|
|
|
|
public static readonly AttachedProperty<bool> AutoCollapseProperty =
|
2024-09-13 22:21:38 +02:00
|
|
|
|
DependencyPropertyHelper.RegisterAttached<bool>("AutoCollapse", typeof(MapPanel));
|
2024-05-27 11:05:22 +02:00
|
|
|
|
|
|
|
|
|
|
public static readonly AttachedProperty<Location> LocationProperty =
|
2024-09-13 22:21:38 +02:00
|
|
|
|
DependencyPropertyHelper.RegisterAttached<Location>("Location", typeof(MapPanel));
|
2024-05-27 11:05:22 +02:00
|
|
|
|
|
|
|
|
|
|
public static readonly AttachedProperty<BoundingBox> BoundingBoxProperty =
|
2024-09-13 22:21:38 +02:00
|
|
|
|
DependencyPropertyHelper.RegisterAttached<BoundingBox>("BoundingBox", typeof(MapPanel));
|
2024-05-27 11:05:22 +02:00
|
|
|
|
|
2024-08-28 14:39:49 +02:00
|
|
|
|
protected IEnumerable<Control> ChildElements => Children;
|
|
|
|
|
|
|
2024-05-27 11:05:22 +02:00
|
|
|
|
static MapPanel()
|
|
|
|
|
|
{
|
|
|
|
|
|
AffectsParentArrange<MapPanel>(LocationProperty, BoundingBoxProperty);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-05-19 23:23:27 +02:00
|
|
|
|
public MapPanel()
|
|
|
|
|
|
{
|
2025-03-24 23:10:31 +01:00
|
|
|
|
if (this is MapBase)
|
2024-05-19 23:23:27 +02:00
|
|
|
|
{
|
2025-03-24 23:10:31 +01:00
|
|
|
|
SetValue(ParentMapProperty, this);
|
2024-05-19 23:23:27 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-05-20 23:24:34 +02:00
|
|
|
|
public static MapBase GetParentMap(Control element)
|
2024-05-19 23:23:27 +02:00
|
|
|
|
{
|
2024-05-20 23:24:34 +02:00
|
|
|
|
return (MapBase)element.GetValue(ParentMapProperty);
|
2024-05-19 23:23:27 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-05-20 23:24:34 +02:00
|
|
|
|
public static void SetRenderTransform(Control element, Transform transform, double originX = 0d, double originY = 0d)
|
2024-05-19 23:23:27 +02:00
|
|
|
|
{
|
2024-05-20 23:24:34 +02:00
|
|
|
|
element.RenderTransform = transform;
|
|
|
|
|
|
element.RenderTransformOrigin = new RelativePoint(originX, originY, RelativeUnit.Relative);
|
2024-05-19 23:23:27 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-05-20 23:24:34 +02:00
|
|
|
|
private static void SetVisible(Control element, bool visible)
|
2024-05-19 23:23:27 +02:00
|
|
|
|
{
|
2024-05-20 23:24:34 +02:00
|
|
|
|
element.IsVisible = visible;
|
2024-05-19 23:23:27 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|