Tuesday, 17 May 2011

Removing Latebinding using Pushpins to Bing Maps in WP7

 

Here I have specified an Bing Map Control XAML in WP7, and if you wish to add a pushpin with the content “you” on the map, the best way is inside that map control: -

<map Name="Map" CredentialsProvider="{Binding CredentialsProvider}" ZoomLevel="{Binding Zoom, Mode=TwoWay}" Center="{Binding Center, Mode=TwoWay}">

</map>



You write the following code:-



<map:MapLayer Visibility="{Binding UserPosition, Converter={StaticResource GeoCoordinateVisibilityConverter}}">



<map:Pushpin Location="{Binding UserPosition}" Content="you" />



</map:MapLayer>



This allows you to insert a pushpin in a layer, and collapses the layer as well, thus reduces the need for late-binding for setting a data context in Loaded event.



Hope that helps.

No comments: