From 535161c5a3a5d8e51009f3575eb67dc2d2615916 Mon Sep 17 00:00:00 2001 From: Clemens Date: Fri, 25 Feb 2022 20:58:48 +0100 Subject: [PATCH] Update MapPanel.cs --- MapControl/Shared/MapPanel.cs | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/MapControl/Shared/MapPanel.cs b/MapControl/Shared/MapPanel.cs index 8ed39575..c2f59d29 100644 --- a/MapControl/Shared/MapPanel.cs +++ b/MapControl/Shared/MapPanel.cs @@ -3,7 +3,9 @@ // Licensed under the Microsoft Public License (Ms-PL) using System; +using System.Diagnostics; using System.Linq; +using System.Security.Policy; #if WINUI using Windows.Foundation; using Microsoft.UI.Xaml; @@ -219,23 +221,30 @@ namespace MapControl } } - if (position.HasValue) + try { - ArrangeElement(element, position.Value); - } - else - { - var boundingBox = GetBoundingBox(element); - - if (boundingBox != null) + if (position.HasValue) { - ArrangeElement(element, GetViewRect(boundingBox)); + ArrangeElement(element, position.Value); } else { - ArrangeElement(element, finalSize); + var boundingBox = GetBoundingBox(element); + + if (boundingBox != null) + { + ArrangeElement(element, GetViewRect(boundingBox)); + } + else + { + ArrangeElement(element, finalSize); + } } } + catch (Exception ex) + { + Debug.WriteLine($"MapPanel.ArrangeElement: {ex.Message}"); + } } }