ThinkGeo.com    |     Documentation    |     Premium Support

Error message when re-opening the map

At the moment we are migrating our applications from ThinkGeo 10.x to 13.0.1. In principle it works fine but we observe an error when we close the window which contains the map and reopen it. This error message did occur with ThinkGeo 10.x.
The error message is

The specified element is already the logical child of another element. First perform a separation.

bei System.Windows.FrameworkElement.ChangeLogicalParent(DependencyObject newParent)
bei System.Windows.FrameworkElement.AddLogicalChild(Object child)
bei System.Windows.Controls.UIElementCollection.AddInternal(UIElement element)
bei ThinkGeo.Core.MapViewBase.WUs=(Object sender, AddedGeoCollectionEventArgs e)
bei ThinkGeo.Core.GeoCollection`1.OnAdded(AddedGeoCollectionEventArgs e)
bei Rwe.Core.Map.TG.Services.Map.MapManager.ZeigeKarte(KARTEN_KONFIG kartenkonfig) in D:\Agents\Agent_5_work\8\s\dotnet\core\Map\ThinkGeoV2\Services\Map\MapManager.cs:Zeile 1526.

and occurs when we try to add an overly by follwing code
mapView.Overlays.Add( maplayer.Overlay );

The variable mapView is an instance of MapView.
Did anyone observe a similar behaviour and know what to do?

With best regards
Peter

Hi Peter,

That’s interesting - I’ve never seen this exception. Is this a sub-window of a parent application? Or does the error occur every time you exit and then restart the process?

Also, if it’s possible to put together a stripped down and simplified sample .sln that recreates the issue, then I’m sure we can get to the bottom of it quicker.

Thanks,
John

Hi John,
thank you for the reply but meanwhile we found the solution for that problem.
When closing the window which contains the map we have to remove each layer by mapView.Overlays.Remove( … ).
This was not necessary with version 10.x.

With best regards
Peter

Hi Peter,

Glad to know it’s working, and thanks for sharing the solution here.

Thanks,
John