diff --git a/MapControl/Avalonia/MapControl.Avalonia.csproj b/MapControl/Avalonia/MapControl.Avalonia.csproj
index bbe37e0f..6b26e89b 100644
--- a/MapControl/Avalonia/MapControl.Avalonia.csproj
+++ b/MapControl/Avalonia/MapControl.Avalonia.csproj
@@ -37,6 +37,12 @@
+
+
+
+
+
+
diff --git a/MapControl/Shared/MapPanel.cs b/MapControl/Shared/MapPanel.cs
index e99d29ea..a914209c 100644
--- a/MapControl/Shared/MapPanel.cs
+++ b/MapControl/Shared/MapPanel.cs
@@ -46,20 +46,20 @@ namespace MapControl
public static readonly DependencyProperty LocationProperty =
DependencyPropertyHelper.RegisterAttached("Location", null, false,
- (obj, oldVale, newValue) => (obj.Parent as MapPanel)?.InvalidateArrange());
+ (element, oldValue, newValue) => (element.Parent as MapPanel)?.InvalidateArrange());
public static readonly DependencyProperty BoundingBoxProperty =
DependencyPropertyHelper.RegisterAttached("BoundingBox", null, false,
- (obj, oldVale, newValue) => (obj.Parent as MapPanel)?.InvalidateArrange());
+ (element, oldValue, newValue) => (element.Parent as MapPanel)?.InvalidateArrange());
private static readonly DependencyProperty ViewPositionProperty =
DependencyPropertyHelper.RegisterAttached("ViewPosition");
private static readonly DependencyProperty ParentMapProperty =
DependencyPropertyHelper.RegisterAttached("ParentMap", null, true,
- (obj, oldVale, newValue) =>
+ (element, oldValue, newValue) =>
{
- if (obj is IMapElement mapElement)
+ if (element is IMapElement mapElement)
{
mapElement.ParentMap = newValue;
}
diff --git a/MapControl/Shared/MapTileLayerBase.cs b/MapControl/Shared/MapTileLayerBase.cs
index 6f945e54..e2aa841f 100644
--- a/MapControl/Shared/MapTileLayerBase.cs
+++ b/MapControl/Shared/MapTileLayerBase.cs
@@ -32,7 +32,7 @@ namespace MapControl
{
public static readonly DependencyProperty TileSourceProperty =
DependencyPropertyHelper.Register(nameof(TileSource), null, false,
- async (obj, oldVale, newValue) => await obj.Update(true));
+ async (layer, oldValue, newValue) => await layer.Update(true));
public static readonly DependencyProperty SourceNameProperty =
DependencyPropertyHelper.Register(nameof(SourceName));
diff --git a/MapControl/Shared/WmtsTileLayer.cs b/MapControl/Shared/WmtsTileLayer.cs
index 851a5770..6e8f8ad0 100644
--- a/MapControl/Shared/WmtsTileLayer.cs
+++ b/MapControl/Shared/WmtsTileLayer.cs
@@ -2,6 +2,7 @@
// Copyright © 2024 Clemens Fischer
// Licensed under the Microsoft Public License (Ms-PL)
+using Avalonia.Interactivity;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -15,6 +16,8 @@ using Windows.UI.Xaml;
#elif WINUI
using Windows.Foundation;
using Microsoft.UI.Xaml;
+#elif AVALONIA
+using DependencyProperty = Avalonia.AvaloniaProperty;
#endif
namespace MapControl
@@ -24,15 +27,15 @@ namespace MapControl
///
public class WmtsTileLayer : MapTileLayerBase
{
- public static readonly DependencyProperty CapabilitiesUriProperty = DependencyProperty.Register(
- nameof(CapabilitiesUri), typeof(Uri), typeof(WmtsTileLayer),
- new PropertyMetadata(null, (o, e) => ((WmtsTileLayer)o).TileMatrixSets.Clear()));
+ public static readonly DependencyProperty CapabilitiesUriProperty =
+ DependencyPropertyHelper.Register(nameof(CapabilitiesUri), null, false,
+ (layer, oldValue, newValue) => layer.TileMatrixSets.Clear());
- public static readonly DependencyProperty LayerProperty = DependencyProperty.Register(
- nameof(Layer), typeof(string), typeof(WmtsTileLayer), new PropertyMetadata(null));
+ public static readonly DependencyProperty LayerProperty =
+ DependencyPropertyHelper.Register(nameof(Layer));
- public static readonly DependencyProperty PreferredTileMatrixSetsProperty = DependencyProperty.Register(
- nameof(PreferredTileMatrixSets), typeof(string[]), typeof(WmtsTileLayer), new PropertyMetadata(null));
+ public static readonly DependencyProperty PreferredTileMatrixSetsProperty =
+ DependencyPropertyHelper.Register(nameof(PreferredTileMatrixSets));
public WmtsTileLayer()
{
diff --git a/MapControl/Shared/WmtsTileMatrixLayer.cs b/MapControl/Shared/WmtsTileMatrixLayer.cs
index ba774c1c..54251dc8 100644
--- a/MapControl/Shared/WmtsTileMatrixLayer.cs
+++ b/MapControl/Shared/WmtsTileMatrixLayer.cs
@@ -15,6 +15,9 @@ using Windows.UI.Xaml.Media;
using Windows.Foundation;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media;
+#elif AVALONIA
+using Avalonia.Controls;
+using Avalonia.Media;
#endif
namespace MapControl
@@ -25,7 +28,8 @@ namespace MapControl
//
public WmtsTileMatrixLayer(WmtsTileMatrix tileMatrix, int zoomLevel)
{
- RenderTransform = new MatrixTransform();
+ MapPanel.SetRenderTransform(this, new MatrixTransform());
+
WmtsTileMatrix = tileMatrix;
TileMatrix = new TileMatrix(zoomLevel, 1, 1, 0, 0);
}