WPF Bing Map Control. Not have access to the parent Map from a Pushpin

Answered WPF Bing Map Control. Not have access to the parent Map from a Pushpin

  • Monday, August 06, 2012 6:02 AM
     
      Has Code

    Hello!

    Why in WPF Bing Map Control in MapLayer no property ParentMap? But in Silverlight there is a property = (

    <m:Map x:Name="map"  CredentialsProvider="key">
     <m:MapLayer x:Name="mapLayer">
      <m:Pushpin x:Name="pushpin" Location="0,0"/>                
     </m:MapLayer>
    </m:Map>

    pushpin.Parent returns MapLayer, mapLayer.Parent returns MapLayer (why not a Map?), (mapLayer.Parent as MapLayer).Parent returns null.

    How to access to the Map from Pushpin?

    Thank you!


    • Edited by phoenixbk Monday, August 06, 2012 6:02 AM
    •  

All Replies

  • Saturday, August 11, 2012 2:36 PM
    Owner
     
     Answered

    The WPF control uses a better architecture model which makes the MapLayers and Shapes independent of the map. This was done by design. The method used by the Silverlight control actually limits how the controls can be used. If you want to add a reference to the map to the pushpin or the map layer simply set the Tag property to the map object and then use that later as your reference.


    http://rbrundritt.wordpress.com

  • Friday, August 17, 2012 4:21 AM
     
     
    Thank you for the answer! =)