using System.Collections.Generic; using System.Globalization; using System.Windows; using System.Windows.Documents; using System.Windows.Media; namespace MapControl { public partial class MapGrid : FrameworkElement, IMapElement { public static readonly DependencyProperty ForegroundProperty = DependencyPropertyHelper.AddOwner(TextElement.ForegroundProperty); public static readonly DependencyProperty FontFamilyProperty = DependencyPropertyHelper.AddOwner(TextElement.FontFamilyProperty); public static readonly DependencyProperty 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) { OnViewportChanged(e); } protected virtual void OnViewportChanged(ViewportChangedEventArgs e) { InvalidateVisual(); } protected override void OnRender(DrawingContext drawingContext) { if (ParentMap != null) { var pathGeometry = new PathGeometry(); var labels = new List