// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control // Copyright © 2024 Clemens Fischer // Licensed under the Microsoft Public License (Ms-PL) using Avalonia.Collections; using Avalonia.Controls.Documents; using Avalonia.Controls.Shapes; using Avalonia.Data; using Avalonia.Media; namespace MapControl { public partial class MapOverlay { public static readonly StyledProperty FontFamilyProperty = DependencyPropertyHelper.AddOwner(TextElement.FontFamilyProperty); public static readonly StyledProperty FontSizeProperty = DependencyPropertyHelper.AddOwner(TextElement.FontSizeProperty); public static readonly StyledProperty FontStyleProperty = DependencyPropertyHelper.AddOwner(TextElement.FontStyleProperty); public static readonly StyledProperty FontStretchProperty = DependencyPropertyHelper.AddOwner(TextElement.FontStretchProperty); public static readonly StyledProperty FontWeightProperty = DependencyPropertyHelper.AddOwner(TextElement.FontWeightProperty); public static readonly StyledProperty ForegroundProperty = DependencyPropertyHelper.AddOwner(TextElement.ForegroundProperty); public static readonly StyledProperty StrokeProperty = DependencyPropertyHelper.AddOwner(Shape.StrokeProperty); public static readonly StyledProperty StrokeThicknessProperty = DependencyPropertyHelper.Register(nameof(StrokeThickness), 1d); public static readonly StyledProperty> StrokeDashArrayProperty = DependencyPropertyHelper.AddOwner>(Shape.StrokeDashArrayProperty); public static readonly StyledProperty StrokeDashOffsetProperty = DependencyPropertyHelper.AddOwner(Shape.StrokeDashOffsetProperty); public static readonly StyledProperty StrokeLineCapProperty = DependencyPropertyHelper.AddOwner(Shape.StrokeLineCapProperty); public static readonly StyledProperty StrokeLineJoinProperty = DependencyPropertyHelper.AddOwner(Shape.StrokeJoinProperty); public static readonly StyledProperty StrokeMiterLimitProperty = DependencyPropertyHelper.Register(nameof(StrokeMiterLimit)); protected override void OnInitialized() { base.OnInitialized(); if (Stroke == null) { this.SetBinding(StrokeProperty, this.CreateBinding(nameof(Foreground))); } } public Pen CreatePen() { return new Pen { Brush = Stroke, Thickness = StrokeThickness, LineJoin = StrokeLineJoin, MiterLimit = StrokeMiterLimit, LineCap = StrokeLineCap, DashStyle = new DashStyle(StrokeDashArray, StrokeDashOffset) }; } } }