Silverlight Bing Maps with web services

This sample shows how to use the Bing Maps Silverlight control and use a custom web service to consume data from a weather data site and show it on your map with custom icons.

C# (5.5 MB)
 
 
 
 
 
(1)
2,693 times
Add To Favorites
8/3/2011
E-mail Twitter del.icio.us Digg Facebook
Sign in to Ask a Question


  • setview(location,zoomlevel)doesn't work。
    2 Posts | Last Post February 19, 2012
    • using Microsoft.Maps.MapControl;
      private void Dynamic_Click(object sender, RoutedEventArgs e)
              {
                  double latitude = 0;
                  double longitude = 0;
                  double.TryParse(tbLatitude.Text, out latitude);  
                  double.TryParse(tbLongitude.Text, out longitude);  
                  this.map.SetView(new Location(latitude, longitude), 5);  
              }
      when I input the latitude and longitude through two textboxes,and click the button, the view of map always location on a same and wrong position, why? help me,please ,thank u.
       
    • Usually when this is happening, the try parse is failing and your long and lat will be 0 or it could be a different number if the parse works but the default culture doesn't recognise the number as a double. This is normally because of regional settings in how doubles are handled in your operating system
      
      If you use the System.Globalization namespace
      
      and the following code
      
      double.TryParse(tbLatitude.Text,NumberStyles.Float,CultureInfo.InvariantCulture, out latitude);
      
      This should solve your issue.
      
      Also check what value is being outputted and if you are getting a true or false in the tryParse