// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control // Copyright © 2024 Clemens Fischer // Licensed under the Microsoft Public License (Ms-PL) using System; using System.Windows; using System.Windows.Documents; using System.Windows.Media; using System.Windows.Shapes; namespace MapControl { public partial class MapOverlay { public static readonly DependencyProperty FontFamilyProperty = DependencyPropertyHelper.AddOwner(TextElement.FontFamilyProperty, FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.Inherits); public static readonly DependencyProperty FontSizeProperty = DependencyPropertyHelper.AddOwner(TextElement.FontSizeProperty, FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.Inherits); public static readonly DependencyProperty FontStyleProperty = DependencyPropertyHelper.AddOwner(TextElement.FontStyleProperty, FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.Inherits); public static readonly DependencyProperty FontStretchProperty = DependencyPropertyHelper.AddOwner(TextElement.FontStretchProperty, FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.Inherits); public static readonly DependencyProperty FontWeightProperty = DependencyPropertyHelper.AddOwner(TextElement.FontWeightProperty, FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.Inherits); public static readonly DependencyProperty ForegroundProperty = DependencyPropertyHelper.AddOwner(TextElement.ForegroundProperty, FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.Inherits); public static readonly DependencyProperty StrokeProperty = DependencyPropertyHelper.AddOwner(Shape.StrokeProperty, FrameworkPropertyMetadataOptions.AffectsRender); public static readonly DependencyProperty StrokeThicknessProperty = DependencyPropertyHelper.AddOwner(Shape.StrokeThicknessProperty, FrameworkPropertyMetadataOptions.AffectsRender); public static readonly DependencyProperty StrokeDashArrayProperty = DependencyPropertyHelper.AddOwner(Shape.StrokeDashArrayProperty, FrameworkPropertyMetadataOptions.AffectsRender); public static readonly DependencyProperty StrokeDashOffsetProperty = DependencyPropertyHelper.AddOwner(Shape.StrokeDashOffsetProperty, FrameworkPropertyMetadataOptions.AffectsRender); public static readonly DependencyProperty StrokeDashCapProperty = DependencyPropertyHelper.AddOwner(Shape.StrokeDashCapProperty, FrameworkPropertyMetadataOptions.AffectsRender); public static readonly DependencyProperty StrokeStartLineCapProperty = DependencyPropertyHelper.AddOwner(Shape.StrokeStartLineCapProperty, FrameworkPropertyMetadataOptions.AffectsRender); public static readonly DependencyProperty StrokeEndLineCapProperty = DependencyPropertyHelper.AddOwner(Shape.StrokeEndLineCapProperty, FrameworkPropertyMetadataOptions.AffectsRender); public static readonly DependencyProperty StrokeLineJoinProperty = DependencyPropertyHelper.AddOwner(Shape.StrokeLineJoinProperty, FrameworkPropertyMetadataOptions.AffectsRender); public static readonly DependencyProperty StrokeMiterLimitProperty = DependencyPropertyHelper.AddOwner(Shape.StrokeMiterLimitProperty, FrameworkPropertyMetadataOptions.AffectsRender); protected override void OnInitialized(EventArgs e) { base.OnInitialized(e); // If this.Stroke is not explicitly set, bind it to this.Foreground. // this.SetBindingOnUnsetProperty(StrokeProperty, this, ForegroundProperty, nameof(Foreground)); } public Pen CreatePen() { return new Pen { Brush = Stroke, Thickness = StrokeThickness, LineJoin = StrokeLineJoin, MiterLimit = StrokeMiterLimit, StartLineCap = StrokeStartLineCap, EndLineCap = StrokeEndLineCap, DashCap = StrokeDashCap, DashStyle = new DashStyle(StrokeDashArray, StrokeDashOffset) }; } } }