diff --git a/MapControl/Shared/MapPath.cs b/MapControl/Shared/MapPath.cs index 42e31746..2db8bee3 100644 --- a/MapControl/Shared/MapPath.cs +++ b/MapControl/Shared/MapPath.cs @@ -71,8 +71,6 @@ namespace MapControl protected virtual void UpdateData() { - MapPanel.SetLocation(this, Location); - if (parentMap != null && Location != null && Data != null) { var matrix = parentMap.GetMapTransform(Location); @@ -86,6 +84,8 @@ namespace MapControl Data.Transform = new MatrixTransform { Matrix = matrix }; } } + + MapPanel.SetLocation(this, Location); } #region Methods used only by derived classes MapPolyline, MapPolygon and MapMultiPolygon diff --git a/MapControl/UWP/MapControl.UWP.csproj b/MapControl/UWP/MapControl.UWP.csproj index 6bad4ca8..3dda270e 100644 --- a/MapControl/UWP/MapControl.UWP.csproj +++ b/MapControl/UWP/MapControl.UWP.csproj @@ -230,9 +230,6 @@ Animatable.WinUI.cs - - CanvasPanel.cs - GeoImage.WinUI.cs diff --git a/MapControl/WinUI/CanvasPanel.cs b/MapControl/WinUI/CanvasPanel.cs deleted file mode 100644 index 69e243c2..00000000 --- a/MapControl/WinUI/CanvasPanel.cs +++ /dev/null @@ -1,48 +0,0 @@ -// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control -// Copyright © 2023 Clemens Fischer -// Licensed under the Microsoft Public License (Ms-PL) - -using System.Linq; -using Windows.Foundation; -#if WINUI -using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; -#elif UWP -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -#endif - -namespace MapControl -{ - /// - /// Replacement for WinUI and UWP Canvas, which clips MapPath child elements. - /// - public class CanvasPanel : Panel - { - protected override Size MeasureOverride(Size availableSize) - { - availableSize = new Size(double.PositiveInfinity, double.PositiveInfinity); - - foreach (var element in Children.OfType()) - { - element.Measure(availableSize); - } - - return new Size(); - } - - protected override Size ArrangeOverride(Size finalSize) - { - foreach (var element in Children.OfType()) - { - var x = Canvas.GetLeft(element); - var y = Canvas.GetTop(element); - var size = MapPanel.GetDesiredSize(element); - - element.Arrange(new Rect(x, y, size.Width, size.Height)); - } - - return finalSize; - } - } -} diff --git a/SampleApps/UniversalApp/MainPage.xaml b/SampleApps/UniversalApp/MainPage.xaml index 6ac9ba07..d64c04e6 100644 --- a/SampleApps/UniversalApp/MainPage.xaml +++ b/SampleApps/UniversalApp/MainPage.xaml @@ -17,7 +17,7 @@ - + @@ -54,20 +54,12 @@ - - - - - - - @@ -78,10 +70,8 @@ - - - - + + diff --git a/SampleApps/WinUiApp/MainWindow.xaml b/SampleApps/WinUiApp/MainWindow.xaml index 5e59a126..3820e41c 100644 --- a/SampleApps/WinUiApp/MainWindow.xaml +++ b/SampleApps/WinUiApp/MainWindow.xaml @@ -24,7 +24,7 @@ - + @@ -68,7 +68,7 @@ Transform="{Binding MapTransform, RelativeSource={RelativeSource TemplatedParent}}"/> - + @@ -85,10 +85,8 @@ - - - - + + diff --git a/SampleApps/WpfApplication/MainWindow.xaml b/SampleApps/WpfApplication/MainWindow.xaml index c30d4b0b..9cd5d673 100644 --- a/SampleApps/WpfApplication/MainWindow.xaml +++ b/SampleApps/WpfApplication/MainWindow.xaml @@ -77,9 +77,7 @@ - - - +