diff --git a/MapControl/Avalonia/DependencyPropertyHelper.Avalonia.cs b/MapControl/Avalonia/DependencyPropertyHelper.Avalonia.cs index 0415053c..3342165e 100644 --- a/MapControl/Avalonia/DependencyPropertyHelper.Avalonia.cs +++ b/MapControl/Avalonia/DependencyPropertyHelper.Avalonia.cs @@ -2,7 +2,6 @@ // Copyright © 2024 Clemens Fischer // Licensed under the Microsoft Public License (Ms-PL) -using Avalonia.Controls; using System; #pragma warning disable AVP1001 // The same AvaloniaProperty should not be registered twice @@ -82,5 +81,10 @@ namespace MapControl { return AddOwner((StyledProperty)property); } + + public static void SetBinding(this AvaloniaObject target, AvaloniaProperty property, Binding binding) + { + target.Bind(property, binding); + } } } diff --git a/MapControl/Avalonia/ImageLoader.Avalonia.cs b/MapControl/Avalonia/ImageLoader.Avalonia.cs index 7f036c30..48971284 100644 --- a/MapControl/Avalonia/ImageLoader.Avalonia.cs +++ b/MapControl/Avalonia/ImageLoader.Avalonia.cs @@ -2,9 +2,6 @@ // Copyright © 2024 Clemens Fischer // Licensed under the Microsoft Public License (Ms-PL) -using Avalonia.Media; -using Avalonia.Media.Imaging; -using Avalonia.Platform; using System; using System.IO; using System.Threading.Tasks; diff --git a/MapControl/Avalonia/LocationAnimator.Avalonia.cs b/MapControl/Avalonia/LocationAnimator.Avalonia.cs index 7a422131..03af86b8 100644 --- a/MapControl/Avalonia/LocationAnimator.Avalonia.cs +++ b/MapControl/Avalonia/LocationAnimator.Avalonia.cs @@ -2,8 +2,6 @@ // Copyright © 2024 Clemens Fischer // Licensed under the Microsoft Public License (Ms-PL) -using Avalonia.Animation; - namespace MapControl { public class LocationAnimator : InterpolatingAnimator diff --git a/MapControl/Avalonia/Map.Avalonia.cs b/MapControl/Avalonia/Map.Avalonia.cs index 552361c7..82a57b1f 100644 --- a/MapControl/Avalonia/Map.Avalonia.cs +++ b/MapControl/Avalonia/Map.Avalonia.cs @@ -2,7 +2,6 @@ // Copyright © 2024 Clemens Fischer // Licensed under the Microsoft Public License (Ms-PL) -using Avalonia.Input; using System; namespace MapControl diff --git a/MapControl/Avalonia/MapBase.Avalonia.cs b/MapControl/Avalonia/MapBase.Avalonia.cs index 5a758090..d0d78b1c 100644 --- a/MapControl/Avalonia/MapBase.Avalonia.cs +++ b/MapControl/Avalonia/MapBase.Avalonia.cs @@ -2,13 +2,6 @@ // Copyright © 2024 Clemens Fischer // Licensed under the Microsoft Public License (Ms-PL) -global using Avalonia; -using Avalonia.Animation; -using Avalonia.Animation.Easings; -using Avalonia.Controls; -using Avalonia.Controls.Documents; -using Avalonia.Media; -using Avalonia.Styling; using System.Threading; using System.Threading.Tasks; diff --git a/MapControl/Avalonia/MapContentControl.Avalonia.cs b/MapControl/Avalonia/MapContentControl.Avalonia.cs index 067c80d3..ad922fb2 100644 --- a/MapControl/Avalonia/MapContentControl.Avalonia.cs +++ b/MapControl/Avalonia/MapContentControl.Avalonia.cs @@ -2,8 +2,6 @@ // Copyright © 2024 Clemens Fischer // Licensed under the Microsoft Public License (Ms-PL) -using Avalonia.Controls; - namespace MapControl { /// diff --git a/MapControl/Avalonia/MapGraticule.Avalonia.cs b/MapControl/Avalonia/MapGraticule.Avalonia.cs index 805f2e12..2ba3962a 100644 --- a/MapControl/Avalonia/MapGraticule.Avalonia.cs +++ b/MapControl/Avalonia/MapGraticule.Avalonia.cs @@ -2,10 +2,6 @@ // Copyright © 2024 Clemens Fischer // Licensed under the Microsoft Public License (Ms-PL) -using Avalonia.Controls; -using Avalonia.Controls.Documents; -using Avalonia.Controls.Shapes; -using Avalonia.Media; using System.Collections.Generic; using System.Globalization; using System.Linq; diff --git a/MapControl/Avalonia/MapPanel.Avalonia.cs b/MapControl/Avalonia/MapPanel.Avalonia.cs index 7d30e6ba..894ccac8 100644 --- a/MapControl/Avalonia/MapPanel.Avalonia.cs +++ b/MapControl/Avalonia/MapPanel.Avalonia.cs @@ -2,13 +2,24 @@ // Copyright © 2024 Clemens Fischer // Licensed under the Microsoft Public License (Ms-PL) -using Avalonia.Controls; -using Avalonia.Media; - namespace MapControl { public partial class MapPanel { + public static readonly AttachedProperty AutoCollapseProperty = + DependencyPropertyHelper.RegisterAttached("AutoCollapse"); + + public static readonly AttachedProperty LocationProperty = + DependencyPropertyHelper.RegisterAttached("Location"); + + public static readonly AttachedProperty BoundingBoxProperty = + DependencyPropertyHelper.RegisterAttached("BoundingBox"); + + static MapPanel() + { + AffectsParentArrange(LocationProperty, BoundingBoxProperty); + } + public MapPanel() { if (this is MapBase mapBase) diff --git a/MapControl/Avalonia/MapPath.Avalonia.cs b/MapControl/Avalonia/MapPath.Avalonia.cs index 0b74f9bf..b20c18a6 100644 --- a/MapControl/Avalonia/MapPath.Avalonia.cs +++ b/MapControl/Avalonia/MapPath.Avalonia.cs @@ -2,9 +2,6 @@ // Copyright © 2024 Clemens Fischer // Licensed under the Microsoft Public License (Ms-PL) -using Avalonia.Controls.Shapes; -using Avalonia.Media; - namespace MapControl { public partial class MapPath : Shape diff --git a/MapControl/Avalonia/MapPolypoint.Avalonia.cs b/MapControl/Avalonia/MapPolypoint.Avalonia.cs index 37322d26..33a883a8 100644 --- a/MapControl/Avalonia/MapPolypoint.Avalonia.cs +++ b/MapControl/Avalonia/MapPolypoint.Avalonia.cs @@ -2,7 +2,6 @@ // Copyright © 2024 Clemens Fischer // Licensed under the Microsoft Public License (Ms-PL) -using Avalonia.Media; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; diff --git a/MapControl/Avalonia/OpacityHelper.Avalonia.cs b/MapControl/Avalonia/OpacityHelper.Avalonia.cs index b2054b71..6413cf4c 100644 --- a/MapControl/Avalonia/OpacityHelper.Avalonia.cs +++ b/MapControl/Avalonia/OpacityHelper.Avalonia.cs @@ -4,10 +4,6 @@ using System.Threading.Tasks; using System; -using Avalonia.Controls; -using Avalonia.Animation; -using Avalonia.Styling; -using System.Xml.Linq; namespace MapControl { diff --git a/MapControl/Avalonia/PushpinBorder.Avalonia.cs b/MapControl/Avalonia/PushpinBorder.Avalonia.cs index b7e347f7..991a67b5 100644 --- a/MapControl/Avalonia/PushpinBorder.Avalonia.cs +++ b/MapControl/Avalonia/PushpinBorder.Avalonia.cs @@ -2,8 +2,6 @@ // Copyright © 2024 Clemens Fischer // Licensed under the Microsoft Public License (Ms-PL) -using Avalonia.Controls; -using Avalonia.Media; using System; namespace MapControl diff --git a/MapControl/Avalonia/TileImageLoader.Avalonia.cs b/MapControl/Avalonia/TileImageLoader.Avalonia.cs index b8f2a410..37b35c39 100644 --- a/MapControl/Avalonia/TileImageLoader.Avalonia.cs +++ b/MapControl/Avalonia/TileImageLoader.Avalonia.cs @@ -2,10 +2,7 @@ // Copyright © 2024 Clemens Fischer // Licensed under the Microsoft Public License (Ms-PL) -using Avalonia.Media; -using Avalonia.Threading; using System; -using System.IO; using System.Threading.Tasks; namespace MapControl @@ -16,7 +13,7 @@ namespace MapControl /// Default folder where the Cache instance may save data, i.e. "C:\ProgramData\MapControl\TileCache". /// public static string DefaultCacheFolder => - Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MapControl", "TileCache"); + System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MapControl", "TileCache"); private static async Task LoadTileAsync(Tile tile, Func> loadImageFunc) diff --git a/MapControl/Shared/BingMapsTileLayer.cs b/MapControl/Shared/BingMapsTileLayer.cs index 7dcf21c0..b7334dd4 100644 --- a/MapControl/Shared/BingMapsTileLayer.cs +++ b/MapControl/Shared/BingMapsTileLayer.cs @@ -13,8 +13,6 @@ using System.Windows; using Windows.UI.Xaml; #elif WINUI using Microsoft.UI.Xaml; -#elif AVALONIA -using Avalonia.Interactivity; #endif namespace MapControl diff --git a/MapControl/Shared/BoundingBoxTileSource.cs b/MapControl/Shared/BoundingBoxTileSource.cs index eb99e80d..1444db03 100644 --- a/MapControl/Shared/BoundingBoxTileSource.cs +++ b/MapControl/Shared/BoundingBoxTileSource.cs @@ -11,8 +11,6 @@ using System.Windows.Media; using Windows.UI.Xaml.Media; #elif WINUI using Microsoft.UI.Xaml.Media; -#elif AVALONIA -using ImageSource = Avalonia.Media.IImage; #endif namespace MapControl diff --git a/MapControl/Shared/FilePath.cs b/MapControl/Shared/FilePath.cs index 1cc602dc..b43231d9 100644 --- a/MapControl/Shared/FilePath.cs +++ b/MapControl/Shared/FilePath.cs @@ -2,8 +2,6 @@ // Copyright © 2024 Clemens Fischer // Licensed under the Microsoft Public License (Ms-PL) -using System.IO; - namespace MapControl { public static class FilePath @@ -11,9 +9,9 @@ namespace MapControl public static string GetFullPath(string path) { #if NET6_0_OR_GREATER - return Path.GetFullPath(path, System.AppDomain.CurrentDomain.BaseDirectory); + return System.IO.Path.GetFullPath(path, System.AppDomain.CurrentDomain.BaseDirectory); #else - return Path.GetFullPath(path); + return System.IO.Path.GetFullPath(path); #endif } } diff --git a/MapControl/Shared/GroundOverlay.cs b/MapControl/Shared/GroundOverlay.cs index 5383f72e..68ff2bcb 100644 --- a/MapControl/Shared/GroundOverlay.cs +++ b/MapControl/Shared/GroundOverlay.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; +using Path = System.IO.Path; using System.IO.Compression; using System.Linq; using System.Threading.Tasks; @@ -23,12 +24,6 @@ using Windows.UI.Xaml.Media; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Media; -#elif AVALONIA -using Avalonia.Controls; -using Avalonia.Media; -using DependencyProperty = Avalonia.AvaloniaProperty; -using FrameworkElement = Avalonia.Controls.Control; -using ImageSource = Avalonia.Media.IImage; #endif namespace MapControl diff --git a/MapControl/Shared/ImageFileCache.cs b/MapControl/Shared/ImageFileCache.cs index dab44604..a1bde7b5 100644 --- a/MapControl/Shared/ImageFileCache.cs +++ b/MapControl/Shared/ImageFileCache.cs @@ -8,6 +8,7 @@ using Microsoft.Extensions.Options; using System; using System.Diagnostics; using System.IO; +using Path = System.IO.Path; using System.Linq; using System.Text; using System.Threading; diff --git a/MapControl/Shared/ImageLoader.cs b/MapControl/Shared/ImageLoader.cs index 20bf5dc2..bd23908b 100644 --- a/MapControl/Shared/ImageLoader.cs +++ b/MapControl/Shared/ImageLoader.cs @@ -15,8 +15,6 @@ using System.Windows.Media; using Windows.UI.Xaml.Media; #elif WINUI using Microsoft.UI.Xaml.Media; -#elif AVALONIA -using ImageSource = Avalonia.Media.IImage; #endif namespace MapControl diff --git a/MapControl/Shared/MapBase.cs b/MapControl/Shared/MapBase.cs index f2be3866..fcb501fd 100644 --- a/MapControl/Shared/MapBase.cs +++ b/MapControl/Shared/MapBase.cs @@ -2,7 +2,6 @@ // Copyright © 2024 Clemens Fischer // Licensed under the Microsoft Public License (Ms-PL) -using System; #if WPF using System.Windows; using System.Windows.Media; @@ -13,10 +12,33 @@ using Windows.UI.Xaml.Media; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Media; #elif AVALONIA -using Brush = Avalonia.Media.IBrush; -using DependencyProperty = Avalonia.AvaloniaProperty; -using UIElement = Avalonia.Controls.Control; +global using Avalonia; +global using Avalonia.Animation; +global using Avalonia.Animation.Easings; +global using Avalonia.Controls; +global using Avalonia.Controls.Documents; +global using Avalonia.Controls.Shapes; +global using Avalonia.Data; +global using Avalonia.Input; +global using Avalonia.Interactivity; +global using Avalonia.Media; +global using Avalonia.Media.Imaging; +global using Avalonia.Platform; +global using Avalonia.Styling; +global using Avalonia.Threading; +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; +global using PathFigureCollection = Avalonia.Media.PathFigures; +global using PointCollection = System.Collections.Generic.List; +global using PropertyPath = System.String; #endif +using System; namespace MapControl { diff --git a/MapControl/Shared/MapBorderPanel.cs b/MapControl/Shared/MapBorderPanel.cs index 5c2ed112..39e5c03d 100644 --- a/MapControl/Shared/MapBorderPanel.cs +++ b/MapControl/Shared/MapBorderPanel.cs @@ -8,9 +8,6 @@ using System.Windows; using Windows.UI.Xaml; #elif WINUI using Microsoft.UI.Xaml; -#elif AVALONIA -using DependencyProperty = Avalonia.AvaloniaProperty; -using FrameworkElement = Avalonia.Controls.Control; #endif namespace MapControl diff --git a/MapControl/Shared/MapGraticule.cs b/MapControl/Shared/MapGraticule.cs index 97edb726..77d97a9e 100644 --- a/MapControl/Shared/MapGraticule.cs +++ b/MapControl/Shared/MapGraticule.cs @@ -15,10 +15,6 @@ using Windows.UI.Xaml.Media; #elif WINUI using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Media; -#elif AVALONIA -using Avalonia.Media; -using DependencyProperty = Avalonia.AvaloniaProperty; -using PathFigureCollection = Avalonia.Media.PathFigures; #endif namespace MapControl diff --git a/MapControl/Shared/MapImageLayer.cs b/MapControl/Shared/MapImageLayer.cs index 5a8276e0..60385f6c 100644 --- a/MapControl/Shared/MapImageLayer.cs +++ b/MapControl/Shared/MapImageLayer.cs @@ -20,13 +20,6 @@ using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Media; using DispatcherTimer = Microsoft.UI.Dispatching.DispatcherQueueTimer; -#elif AVALONIA -using Avalonia.Controls; -using Avalonia.Media; -using Avalonia.Threading; -using Brush = Avalonia.Media.IBrush; -using DependencyProperty = Avalonia.AvaloniaProperty; -using ImageSource = Avalonia.Media.IImage; #endif namespace MapControl diff --git a/MapControl/Shared/MapPanel.cs b/MapControl/Shared/MapPanel.cs index 6d5a1a9a..6417b969 100644 --- a/MapControl/Shared/MapPanel.cs +++ b/MapControl/Shared/MapPanel.cs @@ -18,13 +18,6 @@ using Windows.Foundation; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Media; -#elif AVALONIA -using Avalonia.Controls; -using Avalonia.Media; -using DependencyProperty = Avalonia.AvaloniaProperty; -using FrameworkElement = Avalonia.Controls.Control; -using HorizontalAlignment = Avalonia.Layout.HorizontalAlignment; -using VerticalAlignment = Avalonia.Layout.VerticalAlignment; #endif /// @@ -43,17 +36,6 @@ namespace MapControl public partial class MapPanel : Panel, IMapElement { - public static readonly DependencyProperty AutoCollapseProperty = - DependencyPropertyHelper.RegisterAttached("AutoCollapse"); - - public static readonly DependencyProperty LocationProperty = - DependencyPropertyHelper.RegisterAttached("Location", null, - (element, oldValue, newValue) => (element.Parent as MapPanel)?.InvalidateArrange()); - - public static readonly DependencyProperty BoundingBoxProperty = - DependencyPropertyHelper.RegisterAttached("BoundingBox", null, - (element, oldValue, newValue) => (element.Parent as MapPanel)?.InvalidateArrange()); - private static readonly DependencyProperty ViewPositionProperty = DependencyPropertyHelper.RegisterAttached("ViewPosition"); diff --git a/MapControl/Shared/MapPath.cs b/MapControl/Shared/MapPath.cs index c16a7ef6..d68ff5a7 100644 --- a/MapControl/Shared/MapPath.cs +++ b/MapControl/Shared/MapPath.cs @@ -11,9 +11,6 @@ using Windows.UI.Xaml.Media; #elif WINUI using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Media; -#elif AVALONIA -using DependencyProperty = Avalonia.AvaloniaProperty; -using PathFigureCollection = Avalonia.Media.PathFigures; #endif namespace MapControl diff --git a/MapControl/Shared/MapPolygon.cs b/MapControl/Shared/MapPolygon.cs index 4449ebc0..9bd1d252 100644 --- a/MapControl/Shared/MapPolygon.cs +++ b/MapControl/Shared/MapPolygon.cs @@ -9,8 +9,6 @@ using System.Windows; using Windows.UI.Xaml; #elif WINUI using Microsoft.UI.Xaml; -#elif AVALONIA -using DependencyProperty = Avalonia.AvaloniaProperty; #endif namespace MapControl diff --git a/MapControl/Shared/MapPolyline.cs b/MapControl/Shared/MapPolyline.cs index ffb0b5a4..d4a2581e 100644 --- a/MapControl/Shared/MapPolyline.cs +++ b/MapControl/Shared/MapPolyline.cs @@ -9,8 +9,6 @@ using System.Windows; using Windows.UI.Xaml; #elif WINUI using Microsoft.UI.Xaml; -#elif AVALONIA -using DependencyProperty = Avalonia.AvaloniaProperty; #endif namespace MapControl diff --git a/MapControl/Shared/MapScale.cs b/MapControl/Shared/MapScale.cs index 0ff328a7..9a55b9f2 100644 --- a/MapControl/Shared/MapScale.cs +++ b/MapControl/Shared/MapScale.cs @@ -24,14 +24,6 @@ using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Data; using Microsoft.UI.Xaml.Media; using Microsoft.UI.Xaml.Shapes; -#elif AVALONIA -using Avalonia.Data; -using Avalonia.Controls; -using Avalonia.Controls.Shapes; -using DependencyProperty = Avalonia.AvaloniaProperty; -using HorizontalAlignment = Avalonia.Layout.HorizontalAlignment; -using VerticalAlignment = Avalonia.Layout.VerticalAlignment; -using PointCollection = System.Collections.Generic.List; #endif namespace MapControl @@ -78,19 +70,12 @@ namespace MapControl { base.SetParentMap(map); -#if AVALONIA - line.Bind(Shape.StrokeProperty, - new Binding { Source = map, Path = nameof(MapBase.Foreground) }); - - line.Bind(Shape.StrokeThicknessProperty, - new Binding { Source = this, Path = nameof(StrokeThickness) }); -#else line.SetBinding(Shape.StrokeProperty, new Binding { Source = map, Path = new PropertyPath(nameof(MapBase.Foreground)) }); line.SetBinding(Shape.StrokeThicknessProperty, new Binding { Source = this, Path = new PropertyPath(nameof(StrokeThickness)) }); -#endif + #if UWP || WINUI label.SetBinding(TextBlock.ForegroundProperty, new Binding { Source = map, Path = new PropertyPath(nameof(MapBase.Foreground)) }); diff --git a/MapControl/Shared/MapTileLayer.cs b/MapControl/Shared/MapTileLayer.cs index 0e2d92c9..51f74674 100644 --- a/MapControl/Shared/MapTileLayer.cs +++ b/MapControl/Shared/MapTileLayer.cs @@ -15,9 +15,6 @@ using Windows.UI.Xaml.Media; using Windows.Foundation; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Media; -#elif AVALONIA -using Avalonia.Media; -using DependencyProperty = Avalonia.AvaloniaProperty; #endif namespace MapControl diff --git a/MapControl/Shared/MapTileLayerBase.cs b/MapControl/Shared/MapTileLayerBase.cs index 2a2bbf7e..38a94b8f 100644 --- a/MapControl/Shared/MapTileLayerBase.cs +++ b/MapControl/Shared/MapTileLayerBase.cs @@ -19,12 +19,6 @@ using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Media; using DispatcherTimer = Microsoft.UI.Dispatching.DispatcherQueueTimer; -#elif AVALONIA -using Avalonia.Controls; -using Avalonia.Media; -using Avalonia.Threading; -using Brush = Avalonia.Media.IBrush; -using DependencyProperty = Avalonia.AvaloniaProperty; #endif namespace MapControl diff --git a/MapControl/Shared/PushpinBorder.cs b/MapControl/Shared/PushpinBorder.cs index 34bcc72f..3097e607 100644 --- a/MapControl/Shared/PushpinBorder.cs +++ b/MapControl/Shared/PushpinBorder.cs @@ -14,9 +14,6 @@ using Windows.UI.Xaml.Media; using Windows.Foundation; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Media; -#elif AVALONIA -using Avalonia.Media; -using HorizontalAlignment = Avalonia.Layout.HorizontalAlignment; #endif namespace MapControl diff --git a/MapControl/Shared/Tile.cs b/MapControl/Shared/Tile.cs index ef80501e..2fb455d1 100644 --- a/MapControl/Shared/Tile.cs +++ b/MapControl/Shared/Tile.cs @@ -12,10 +12,6 @@ using Windows.UI.Xaml.Media; #elif WINUI using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Media; -#elif AVALONIA -using Avalonia.Controls; -using Avalonia.Media; -using ImageSource = Avalonia.Media.IImage; #endif namespace MapControl diff --git a/MapControl/Shared/TileImageLoader.cs b/MapControl/Shared/TileImageLoader.cs index 9aee0683..bd261bf9 100644 --- a/MapControl/Shared/TileImageLoader.cs +++ b/MapControl/Shared/TileImageLoader.cs @@ -9,7 +9,6 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; -using System.IO; using System.Linq; using System.Threading.Tasks; @@ -147,7 +146,7 @@ namespace MapControl private static async Task LoadCachedTileAsync(Tile tile, Uri uri, string cacheName) { - var extension = Path.GetExtension(uri.LocalPath); + var extension = System.IO.Path.GetExtension(uri.LocalPath); if (string.IsNullOrEmpty(extension) || extension.Equals(".jpeg", StringComparison.OrdinalIgnoreCase)) { diff --git a/MapControl/Shared/TileSource.cs b/MapControl/Shared/TileSource.cs index 86e80149..074f4f8d 100644 --- a/MapControl/Shared/TileSource.cs +++ b/MapControl/Shared/TileSource.cs @@ -10,8 +10,6 @@ using System.Windows.Media; using Windows.UI.Xaml.Media; #elif WINUI using Microsoft.UI.Xaml.Media; -#elif AVALONIA -using ImageSource = Avalonia.Media.IImage; #endif namespace MapControl diff --git a/MapControl/Shared/Timer.cs b/MapControl/Shared/Timer.cs index 47f69e3e..763b74ec 100644 --- a/MapControl/Shared/Timer.cs +++ b/MapControl/Shared/Timer.cs @@ -8,9 +8,6 @@ using System.Windows; using System.Windows.Threading; #elif UWP using Windows.UI.Xaml; -#elif AVALONIA -using Avalonia.Threading; -using DependencyObject = Avalonia.AvaloniaObject; #endif namespace MapControl diff --git a/MapControl/Shared/WmsImageLayer.cs b/MapControl/Shared/WmsImageLayer.cs index 80b3d019..247811a8 100644 --- a/MapControl/Shared/WmsImageLayer.cs +++ b/MapControl/Shared/WmsImageLayer.cs @@ -17,9 +17,6 @@ using Windows.UI.Xaml.Media; #elif WINUI using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Media; -#elif AVALONIA -using DependencyProperty = Avalonia.AvaloniaProperty; -using ImageSource = Avalonia.Media.IImage; #endif namespace MapControl diff --git a/MapControl/Shared/WmtsTileLayer.cs b/MapControl/Shared/WmtsTileLayer.cs index e10637f0..9bc816ac 100644 --- a/MapControl/Shared/WmtsTileLayer.cs +++ b/MapControl/Shared/WmtsTileLayer.cs @@ -15,9 +15,6 @@ using Windows.UI.Xaml; #elif WINUI using Windows.Foundation; using Microsoft.UI.Xaml; -#elif AVALONIA -using Avalonia.Interactivity; -using DependencyProperty = Avalonia.AvaloniaProperty; #endif namespace MapControl diff --git a/MapControl/Shared/WmtsTileMatrixLayer.cs b/MapControl/Shared/WmtsTileMatrixLayer.cs index 54251dc8..87062ddf 100644 --- a/MapControl/Shared/WmtsTileMatrixLayer.cs +++ b/MapControl/Shared/WmtsTileMatrixLayer.cs @@ -15,9 +15,6 @@ 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 diff --git a/MapControl/WPF/DependencyPropertyHelper.WPF.cs b/MapControl/WPF/DependencyPropertyHelper.WPF.cs index 811a28aa..00a7a444 100644 --- a/MapControl/WPF/DependencyPropertyHelper.WPF.cs +++ b/MapControl/WPF/DependencyPropertyHelper.WPF.cs @@ -15,7 +15,9 @@ namespace MapControl FrameworkPropertyMetadataOptions options) where TOwner : DependencyObject { - return DependencyProperty.Register(name, typeof(TValue), typeof(TOwner), new FrameworkPropertyMetadata(defaultValue, options)); + var metadata = new FrameworkPropertyMetadata(defaultValue, options); + + return DependencyProperty.Register(name, typeof(TValue), typeof(TOwner), metadata); } public static DependencyProperty Register( @@ -45,6 +47,16 @@ namespace MapControl return DependencyProperty.Register(name, typeof(TValue), typeof(TOwner), metadata); } + public static DependencyProperty RegisterAttached( + string name, + TValue defaultValue, + FrameworkPropertyMetadataOptions options) + { + var metadata = new FrameworkPropertyMetadata(defaultValue, options); + + return DependencyProperty.RegisterAttached(name, typeof(TValue), typeof(TOwner), metadata); + } + public static DependencyProperty RegisterAttached( string name, TValue defaultValue = default, diff --git a/MapControl/WPF/MapPanel.WPF.cs b/MapControl/WPF/MapPanel.WPF.cs index 1e54c928..66cdddfe 100644 --- a/MapControl/WPF/MapPanel.WPF.cs +++ b/MapControl/WPF/MapPanel.WPF.cs @@ -11,6 +11,17 @@ namespace MapControl { public partial class MapPanel { + public static readonly DependencyProperty AutoCollapseProperty = + DependencyPropertyHelper.RegisterAttached("AutoCollapse"); + + public static readonly DependencyProperty LocationProperty = + DependencyPropertyHelper.RegisterAttached("Location", null, + FrameworkPropertyMetadataOptions.AffectsParentArrange); + + public static readonly DependencyProperty BoundingBoxProperty = + DependencyPropertyHelper.RegisterAttached("BoundingBox", null, + FrameworkPropertyMetadataOptions.AffectsParentArrange); + public MapPanel() { if (this is MapBase) diff --git a/MapControl/WinUI/MapPanel.WinUI.cs b/MapControl/WinUI/MapPanel.WinUI.cs index 2bbefd18..8695317c 100644 --- a/MapControl/WinUI/MapPanel.WinUI.cs +++ b/MapControl/WinUI/MapPanel.WinUI.cs @@ -16,6 +16,17 @@ namespace MapControl { public partial class MapPanel { + public static readonly DependencyProperty AutoCollapseProperty = + DependencyPropertyHelper.RegisterAttached("AutoCollapse"); + + public static readonly DependencyProperty LocationProperty = + DependencyPropertyHelper.RegisterAttached("Location", null, + (element, oldValue, newValue) => (element.Parent as MapPanel)?.InvalidateArrange()); + + public static readonly DependencyProperty BoundingBoxProperty = + DependencyPropertyHelper.RegisterAttached("BoundingBox", null, + (element, oldValue, newValue) => (element.Parent as MapPanel)?.InvalidateArrange()); + public MapPanel() { InitMapElement(this);