I\'m trying to get a map overlay working on Windows Phone 8 using an MVVM code structure. I can\'t seem to get the GeoCoordinate property of the MapOverlay to bind to my Vie
That's a limitation of the Silverlight XAML Parser. Objects initialized as part of XAML elements' properties will not participate in the same logical tree and as such don't have datacontext drilling down into them.
In order to databind the new Nokia Map control, use MapExtensions from the new Windows Phone Toolkit. For example here's how to create a PushPin in a specific GeoCoordinate using MapExtensions.
<maps:Map x:Name="Map" Grid.Row="1" Hold="OnMapHold">
<maptk:MapExtensions.Children>
<maptk:Pushpin x:Name="RouteDirectionsPushPin" Visibility="Collapsed"/>
<maptk:MapItemsControl Name="StoresMapItemsControl">
<maptk:MapItemsControl.ItemTemplate>
<DataTemplate>
<maptk:Pushpin GeoCoordinate="{Binding GeoCoordinate}" Visibility="{Binding Visibility}" Content="{Binding Address}"/>
</DataTemplate>
</maptk:MapItemsControl.ItemTemplate>
</maptk:MapItemsControl>
<maptk:UserLocationMarker x:Name="UserLocationMarker" Visibility="Collapsed"/>
</maptk:MapExtensions.Children>
</maps:Map>
To fix this you need to implicitly tell your binding where to find the property, in MVVM Light world it would look like:
<maps:MapOverlay GeoCoordinate="{Binding Main.CurrentLocation, Source={StaticResource Locator}}">
<Ellipse Fill="Blue" Height="20" Width="20" Opacity="50" />
</maps:MapOverlay>
also, you will need the dispatcher on the viewmodel to handle the ui change