From 62b1bb24d7fcbcfdff488eef03d5b8309fc7ddff Mon Sep 17 00:00:00 2001 From: ClemensFischer Date: Sat, 12 Nov 2022 17:27:49 +0100 Subject: [PATCH] Update MapImageLayer.cs --- MapControl/Shared/MapImageLayer.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/MapControl/Shared/MapImageLayer.cs b/MapControl/Shared/MapImageLayer.cs index 87b17499..3889a327 100644 --- a/MapControl/Shared/MapImageLayer.cs +++ b/MapControl/Shared/MapImageLayer.cs @@ -141,15 +141,9 @@ namespace MapControl protected override void SetParentMap(MapBase map) { - if (map == null) + if (map != null) { - updateTimer.Stop(); - ClearImages(); - Children.Clear(); - } - else if (Children.Count == 0) - { - for (int i = 0; i < 2; i++) + while (Children.Count < 2) { Children.Add(new Image { @@ -159,6 +153,12 @@ namespace MapControl }); } } + else + { + updateTimer.Stop(); + ClearImages(); + Children.Clear(); + } base.SetParentMap(map); }