locked
How to copy Bing Map RRS feed

  • Question

  • Hi everyone, I have a Bing Map with pushpin and polylines on it. Now I want to create a copy of that map and put it in scatterviewitem. I just achieved to create another map in scatterviewitem, but this map doesn't have pushpin and polylines on it like the main map. Another problem is I want that if I place a pushpin on the submap, which is in scatterviewitem, the main map can receive that pushpin too. Do you have any idea on how to solve these? Thanks in advance.
    Wednesday, September 25, 2013 7:11 PM

Answers

  • To loop through the layers simply start off with the first layer Map.Children and then loop through all shapes in that layer (it's a collection). You can tell what type of shape you each item is by doing a simple check like this "bool isPushpin = item is Pushpin;". If you encounter a MapLayer then do the same search through it.

    If you copy a Draggable pushpin you have to make sure you create a new Draggable pushpin with the same options as the one in your original map, other wise the dragging might be disabled.


    http://rbrundritt.wordpress.com

    • Proposed as answer by Ricky_Brundritt Wednesday, October 30, 2013 9:49 AM
    • Marked as answer by Faro Luce Thursday, November 7, 2013 11:01 PM
    Wednesday, October 30, 2013 9:49 AM
  • Simple, just read the Location property of the Draggable pushpin.

    If you want to fire an event after the pin was dragged, take a look at the Windows 8 version of this class that I created and migrate over the DragEnd functionality: http://www.bing.com/blogs/site_blogs/b/maps/archive/2013/10/03/draggable-pushpins-in-bing-maps-net.aspx


    http://rbrundritt.wordpress.com


    • Edited by Ricky_Brundritt Thursday, October 31, 2013 7:27 PM
    • Proposed as answer by Ricky_Brundritt Thursday, October 31, 2013 7:28 PM
    • Marked as answer by Faro Luce Thursday, November 7, 2013 11:01 PM
    Thursday, October 31, 2013 7:25 PM
  • You will have to loop through all the layers on your map and create copies of all the shapes and add them to the new map.

    http://rbrundritt.wordpress.com

    Wednesday, October 9, 2013 3:29 PM

All replies

  • You will have to loop through all the layers on your map and create copies of all the shapes and add them to the new map.

    http://rbrundritt.wordpress.com

    Wednesday, October 9, 2013 3:29 PM
  • Do you know how I can loop through all the layers of the map? Another thing is when I copy a draggable pushpin from one map to another map, it doesn't move anymore. Do you know how I can fix this problem? Thanks a lot.
    Wednesday, October 9, 2013 6:54 PM
  • To loop through the layers simply start off with the first layer Map.Children and then loop through all shapes in that layer (it's a collection). You can tell what type of shape you each item is by doing a simple check like this "bool isPushpin = item is Pushpin;". If you encounter a MapLayer then do the same search through it.

    If you copy a Draggable pushpin you have to make sure you create a new Draggable pushpin with the same options as the one in your original map, other wise the dragging might be disabled.


    http://rbrundritt.wordpress.com

    • Proposed as answer by Ricky_Brundritt Wednesday, October 30, 2013 9:49 AM
    • Marked as answer by Faro Luce Thursday, November 7, 2013 11:01 PM
    Wednesday, October 30, 2013 9:49 AM
  • About the DraggablePushpin, how can I retrieve the last location of the pushpin after the user moved it around on the map because it requires the location to create a new DraggablePushpin? Thanks a lot.


    • Edited by Faro Luce Thursday, October 31, 2013 6:53 PM
    Thursday, October 31, 2013 6:53 PM
  • Simple, just read the Location property of the Draggable pushpin.

    If you want to fire an event after the pin was dragged, take a look at the Windows 8 version of this class that I created and migrate over the DragEnd functionality: http://www.bing.com/blogs/site_blogs/b/maps/archive/2013/10/03/draggable-pushpins-in-bing-maps-net.aspx


    http://rbrundritt.wordpress.com


    • Edited by Ricky_Brundritt Thursday, October 31, 2013 7:27 PM
    • Proposed as answer by Ricky_Brundritt Thursday, October 31, 2013 7:28 PM
    • Marked as answer by Faro Luce Thursday, November 7, 2013 11:01 PM
    Thursday, October 31, 2013 7:25 PM