diff --git a/MapControl/Shared/MapTileLayerBase.cs b/MapControl/Shared/MapTileLayerBase.cs index 1d478c6b..5468ac3b 100644 --- a/MapControl/Shared/MapTileLayerBase.cs +++ b/MapControl/Shared/MapTileLayerBase.cs @@ -11,16 +11,12 @@ using System.Windows.Controls; using System.Windows.Media; using System.Windows.Threading; #elif UWP -using Windows.UI.Composition; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Hosting; using Windows.UI.Xaml.Media; #elif WINUI -using Microsoft.UI.Composition; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; -using Microsoft.UI.Xaml.Hosting; using Microsoft.UI.Xaml.Media; using DispatcherTimer = Microsoft.UI.Dispatching.DispatcherQueueTimer; #endif @@ -72,11 +68,8 @@ namespace MapControl updateTimer.Tick += async (s, e) => await Update(false); MapPanel.SetRenderTransform(this, new MatrixTransform()); -#if WPF - RenderOptions.SetEdgeMode(this, EdgeMode.Aliased); -#elif UWP || WINUI +#if UWP || WINUI MapPanel.InitMapElement(this); - ElementCompositionPreview.GetElementVisual(this).BorderMode = CompositionBorderMode.Hard; #endif } diff --git a/MapControl/WPF/MapBase.WPF.cs b/MapControl/WPF/MapBase.WPF.cs index 125066e2..c265a1b7 100644 --- a/MapControl/WPF/MapBase.WPF.cs +++ b/MapControl/WPF/MapBase.WPF.cs @@ -81,6 +81,11 @@ namespace MapControl FlowDirectionProperty.OverrideMetadata(typeof(MapBase), new FrameworkPropertyMetadata(FlowDirection.LeftToRight) { Inherits = false }); } + public MapBase() + { + RenderOptions.SetEdgeMode(this, EdgeMode.Aliased); + } + /// /// Gets or sets the EasingFunction of the Center, ZoomLevel and Heading animations. /// The default value is a QuadraticEase with EasingMode.EaseOut. diff --git a/MapControl/WinUI/MapBase.WinUI.cs b/MapControl/WinUI/MapBase.WinUI.cs index 9ce90deb..8e42285d 100644 --- a/MapControl/WinUI/MapBase.WinUI.cs +++ b/MapControl/WinUI/MapBase.WinUI.cs @@ -4,12 +4,16 @@ #if UWP using Windows.UI; +using Windows.UI.Composition; using Windows.UI.Xaml; +using Windows.UI.Xaml.Hosting; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Media.Animation; #else using Microsoft.UI; +using Microsoft.UI.Composition; using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Hosting; using Microsoft.UI.Xaml.Media; using Microsoft.UI.Xaml.Media.Animation; #endif @@ -85,6 +89,8 @@ namespace MapControl FlowDirection = FlowDirection.LeftToRight; SizeChanged += OnSizeChanged; + + ElementCompositionPreview.GetElementVisual(this).BorderMode = CompositionBorderMode.Hard; } ///