MapBase.MapLayer is FrameworkElement

This commit is contained in:
ClemensFischer 2024-05-27 11:18:14 +02:00
parent d9ef169d56
commit 39e00b30d9
4 changed files with 15 additions and 16 deletions

View file

@ -20,7 +20,6 @@ global using Brush = Avalonia.Media.IBrush;
global using ImageSource = Avalonia.Media.IImage;
global using DependencyObject = Avalonia.AvaloniaObject;
global using DependencyProperty = Avalonia.AvaloniaProperty;
global using UIElement = Avalonia.Controls.Control;
global using FrameworkElement = Avalonia.Controls.Control;
global using HorizontalAlignment = Avalonia.Layout.HorizontalAlignment;
global using VerticalAlignment = Avalonia.Layout.VerticalAlignment;
@ -35,8 +34,8 @@ namespace MapControl
{
public partial class MapBase
{
public static readonly StyledProperty<IBrush> ForegroundProperty =
DependencyPropertyHelper.AddOwner<MapBase, IBrush>(TextElement.ForegroundProperty);
public static readonly StyledProperty<Brush> ForegroundProperty =
DependencyPropertyHelper.AddOwner<MapBase, Brush>(TextElement.ForegroundProperty);
public static readonly StyledProperty<Easing> AnimationEasingProperty =
DependencyPropertyHelper.Register<MapBase, Easing>(nameof(AnimationEasing), new QuadraticEaseOut());

View file

@ -10,8 +10,8 @@ namespace MapControl
{
public partial class MapGraticule : Control, IMapElement
{
public static readonly StyledProperty<IBrush> ForegroundProperty =
DependencyPropertyHelper.AddOwner<MapGraticule, IBrush>(TextElement.ForegroundProperty, null,
public static readonly StyledProperty<Brush> ForegroundProperty =
DependencyPropertyHelper.AddOwner<MapGraticule, Brush>(TextElement.ForegroundProperty, null,
(graticule, oldValue, newValue) => graticule.InvalidateVisual());
public static readonly StyledProperty<FontFamily> FontFamilyProperty =
@ -23,7 +23,7 @@ namespace MapControl
public static readonly StyledProperty<double> StrokeThicknessProperty =
DependencyPropertyHelper.AddOwner<MapGraticule, double>(Shape.StrokeThicknessProperty, 0.5);
public IBrush Foreground
public Brush Foreground
{
get => GetValue(ForegroundProperty);
set => SetValue(ForegroundProperty, value);

View file

@ -17,11 +17,11 @@ namespace MapControl
public static readonly StyledProperty<double> BorderWidthProperty =
DependencyPropertyHelper.Register<PushpinBorder, double>(nameof(BorderWidth));
public static readonly StyledProperty<IBrush> BackgroundProperty =
DependencyPropertyHelper.Register<PushpinBorder, IBrush>(nameof(Background));
public static readonly StyledProperty<Brush> BackgroundProperty =
DependencyPropertyHelper.Register<PushpinBorder, Brush>(nameof(Background));
public static readonly StyledProperty<IBrush> BorderBrushProperty =
DependencyPropertyHelper.Register<PushpinBorder, IBrush>(nameof(BorderBrush));
public static readonly StyledProperty<Brush> BorderBrushProperty =
DependencyPropertyHelper.Register<PushpinBorder, Brush>(nameof(BorderBrush));
static PushpinBorder()
{
@ -37,13 +37,13 @@ namespace MapControl
set => SetValue(CornerRadiusProperty, value);
}
public IBrush Background
public Brush Background
{
get => GetValue(BackgroundProperty);
set => SetValue(BackgroundProperty, value);
}
public IBrush BorderBrush
public Brush BorderBrush
{
get => GetValue(BorderBrushProperty);
set => SetValue(BorderBrushProperty, value);

View file

@ -37,7 +37,7 @@ namespace MapControl
DependencyPropertyHelper.Register<MapBase, TimeSpan>(nameof(AnimationDuration), TimeSpan.FromSeconds(0.3));
public static readonly DependencyProperty MapLayerProperty =
DependencyPropertyHelper.Register<MapBase, UIElement>(nameof(MapLayer), null,
DependencyPropertyHelper.Register<MapBase, FrameworkElement>(nameof(MapLayer), null,
(map, oldValue, newValue) => map.MapLayerPropertyChanged(oldValue, newValue));
public static readonly DependencyProperty MapProjectionProperty =
@ -83,9 +83,9 @@ namespace MapControl
/// If the layer implements IMapLayer (like MapTileLayer or MapImageLayer), its (non-null) MapBackground
/// and MapForeground property values are used for the MapBase Background and Foreground properties.
/// </summary>
public UIElement MapLayer
public FrameworkElement MapLayer
{
get => (UIElement)GetValue(MapLayerProperty);
get => (FrameworkElement)GetValue(MapLayerProperty);
set => SetValue(MapLayerProperty, value);
}
@ -431,7 +431,7 @@ namespace MapControl
internalPropertyChange = false;
}
private void MapLayerPropertyChanged(UIElement oldLayer, UIElement newLayer)
private void MapLayerPropertyChanged(FrameworkElement oldLayer, FrameworkElement newLayer)
{
if (oldLayer != null)
{