using Windows.Foundation; using System.Collections.Generic; #if UWP using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Shapes; #else using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Data; using Microsoft.UI.Xaml.Media; using Microsoft.UI.Xaml.Shapes; #endif namespace MapControl { public partial class MapGraticule : MapPanel { public static readonly DependencyProperty ForegroundProperty = DependencyPropertyHelper.Register(nameof(Foreground)); public static readonly DependencyProperty FontFamilyProperty = DependencyPropertyHelper.Register(nameof(FontFamily)); public static readonly DependencyProperty FontSizeProperty = DependencyPropertyHelper.Register(nameof(FontSize), 12d); protected override void SetParentMap(MapBase map) { if (map != null && Foreground == null) { SetBinding(ForegroundProperty, new Binding { Source = map, Path = new PropertyPath(nameof(Foreground)) }); } base.SetParentMap(map); } protected override void OnViewportChanged(ViewportChangedEventArgs e) { Path path; if (Children.Count == 0) { path = new Path { Data = new PathGeometry() }; path.SetBinding(Shape.StrokeProperty, new Binding { Source = this, Path = new PropertyPath(nameof(Foreground)) }); path.SetBinding(Shape.StrokeThicknessProperty, new Binding { Source = this, Path = new PropertyPath(nameof(StrokeThickness)) }); Children.Add(path); } else { path = (Path)Children[0]; } var childrenCount = 1; var labels = new List