I am currently maintaining a application that utilizes the desktop editon wpf map to display many maps on the screen at the same time. I was hoping to move to the wpf desktop edition wpf map to gain some of the responsiveness advantages that that product seems to offer. However everytime I try to display more than one map on the screen with the new product, I get an error about the second map being the logical child of another control, and that i must disconnect it. What confuses me is that this a new fresh control that was never the logical child of anything before! The stack trace tells me that the error occurs at the FrameworkElement.ChangeLogicalParent() method. Is there some caveat that I should know to allow me to add multiple maps on the screen? Is the new control not designed to allow for mulitple instances being displayed at once, is it some kind of singleton? Thanks in advance for any responses, and I really look forward to utilizing the new product.
Displaying Multiple WpfDesktopEdition Maps at the same time
Steven,
Use Object.GetHashCode() to ensure that you are not dealing with the same instance here. Our application allows multiple instance of the map control to be displayed and we have no such problems.
What version are you using?
Klaus, thank you for your insight. I am evaluating Wpf Desktop Edition version 5.5. I think I found the answer to my own probelm, but i want to post it on here just in case anyone else encounters anything similiar. With the Desktop Edition map, I was able to make the layers that wouldn’t change from map to map static members of the class, so I would only have to load those shapefiles once. However the WpfMap does not allow me to share layers between multiple maps like the old one would. I made it so those layers weren’t static variables and I was able to display multiple maps on the screen again. You may be able to provide more information on why this has changed between versions, but I would guess it has to do with the multitheading. Thank you again for your prompt reply.
-Steven
Steven and Klaus,
This is helpful for us also.
Thanks for your discuss and share!
Regards,
Don