using Avalonia; using Avalonia.Controls; using Avalonia.Controls.Documents; using Avalonia.Media; using System.Collections.Generic; using System.Globalization; namespace MapControl { public partial class MapGraticule : Control, IMapElement { static MapGraticule() { AffectsRender(ForegroundProperty); } public static readonly StyledProperty ForegroundProperty = DependencyPropertyHelper.AddOwner(TextElement.ForegroundProperty); public static readonly StyledProperty FontFamilyProperty = DependencyPropertyHelper.AddOwner(TextElement.FontFamilyProperty); public static readonly StyledProperty FontSizeProperty = DependencyPropertyHelper.AddOwner(TextElement.FontSizeProperty, 12d); /// /// Implements IMapElement.ParentMap. /// public MapBase ParentMap { get; set { if (field != null) { field.ViewportChanged -= OnViewportChanged; } field = value; if (field != null) { field.ViewportChanged += OnViewportChanged; } } } private void OnViewportChanged(object sender, ViewportChangedEventArgs e) { InvalidateVisual(); } public override void Render(DrawingContext drawingContext) { if (ParentMap != null) { var pathGeometry = new PathGeometry(); var labels = new List