XAML-Map-Control/MapControl/Avalonia/MapPanel.Avalonia.cs
ClemensFischer 560f44a139 Copyright
2025-01-01 18:57:55 +01:00

52 lines
1.7 KiB
C#

// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
// Copyright © Clemens Fischer
// Licensed under the Microsoft Public License (Ms-PL)
using System.Collections.Generic;
namespace MapControl
{
public partial class MapPanel
{
public static readonly AttachedProperty<bool> AutoCollapseProperty =
DependencyPropertyHelper.RegisterAttached<bool>("AutoCollapse", typeof(MapPanel));
public static readonly AttachedProperty<Location> LocationProperty =
DependencyPropertyHelper.RegisterAttached<Location>("Location", typeof(MapPanel));
public static readonly AttachedProperty<BoundingBox> BoundingBoxProperty =
DependencyPropertyHelper.RegisterAttached<BoundingBox>("BoundingBox", typeof(MapPanel));
protected IEnumerable<Control> ChildElements => Children;
static MapPanel()
{
AffectsParentArrange<MapPanel>(LocationProperty, BoundingBoxProperty);
}
public MapPanel()
{
if (this is MapBase mapBase)
{
SetValue(ParentMapProperty, mapBase);
}
}
public static MapBase GetParentMap(Control element)
{
return (MapBase)element.GetValue(ParentMapProperty);
}
public static void SetRenderTransform(Control element, Transform transform, double originX = 0d, double originY = 0d)
{
element.RenderTransform = transform;
element.RenderTransformOrigin = new RelativePoint(originX, originY, RelativeUnit.Relative);
}
private static void SetVisible(Control element, bool visible)
{
element.IsVisible = visible;
}
}
}