Note that there are some explanatory texts on larger screens.

plurals
  1. PODisplaying Pushpins with Bing Map for WP7
    text
    copied!<p>I'm trying to display a list of positions (from a xml document:using xml reading) in a Bing map with WP7,using the method below, but it doesn't work. When i tried to see what my function is reading, i found out that it's not extracting the Longitude.Where's the problem?</p> <pre><code>void frloc_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { if (e.Error == null) { ListBoxItem areaItem = null; StringReader wkstream = new StringReader(e.Result); XmlReader wkreader = XmlReader.Create(wkstream); string areaName = String.Empty; string Nom = String.Empty; string Photo = String.Empty; string Latitude = String.Empty; string Longitude = String.Empty; string Timing = String.Empty; while (wkreader.Read()) { if (wkreader.NodeType == XmlNodeType.Element) { switch (wkreader.Name) { case ("name"): { Nom = wkreader.ReadElementContentAsString(); areaItem = new ListBoxItem(); areaItem.Content = Nom; } break; case ("photo"): { Photo = wkreader.ReadElementContentAsString(); areaItem = new ListBoxItem(); areaItem.Content = Photo; } break; case ("latitude"): { Latitude = wkreader.ReadElementContentAsString(); areaItem = new ListBoxItem(); areaItem.Content = Latitude; } break; case ("longitude"): { Longitude = wkreader.ReadElementContentAsString(); areaItem = new ListBoxItem(); areaItem.Content = Longitude; } break; } double lat, lon; double.TryParse(Latitude, NumberStyles.Any, CultureInfo.InvariantCulture, out lat); double.TryParse(Longitude, NumberStyles.Any, CultureInfo.InvariantCulture, out lon); GeoCoordinate Loc = new GeoCoordinate(lat, lon); Pushpin wkpin = new Pushpin(); Image wkpinImage = new Image(); wkpin.Content = Nom; wkpinImage.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri("http://weenek.com/markers/" + Photo, UriKind.Absolute)); wkpinImage.Opacity = 0.8; wkpinImage.Stretch = System.Windows.Media.Stretch.None; imageLayer.AddChild(wkpinImage, Loc); map1.Children.Add(wkpin); </code></pre> <p>The xml:</p> <pre><code>&lt;resultat&gt; &lt;ami&gt; &lt;id&gt;547&lt;/id&gt; &lt;nom&gt;Hakim&lt;/nom&gt; &lt;prenom&gt;Abidi&lt;/prenom&gt; &lt;latitude&gt;37.01406741589469&lt;/latitude&gt; &lt;longitude&gt;11.02375026562504&lt;/longitude&gt; &lt;date&gt;2011-12-02&lt;/date&gt; &lt;time&gt;01:09:35&lt;/time&gt; &lt;image&gt;175.jpg&lt;/image&gt; &lt;/ami&gt; &lt;/resultat&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload