웹 서버에서 xml을 구문 분석하고 lat/long 닉네임과 이미지를 포함한 사용자 정보를 얻은 다음지도에 바인딩합니다 (많은 정보가 있음) . WebClient와 XDocument를 사용하여 구문 분석 작업을합니다. 위도/경도의 유형은 무엇이며지도에 바인딩하는 방법은 무엇입니까?xml 구문 분석 wp7에서지도에 위도/경도 바인딩
void webClient_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
{
using (var reader = new StreamReader(e.Result))
{
// string[] _elements = { "one", "two", "three" };
int[] counter = { 1 };
string s = reader.ReadToEnd();
Stream str = e.Result;
str.Position = 0;
XDocument xdoc = XDocument.Load(str);
var data = from query in xdoc.Descendants("position")
select new mapping
{
// color = counter[0]++,
album = (string)query.Element("album"),
track = (string)query.Element("track"),
artist = (string)query.Element("artist"),
nickname = (string)query.Element("user_info").Element("nickname"),
pos_lat = (GeoCoordinate)query.Element("lat"),
};
// lb1.ItemsSource = data;
// listbox1.ItemsSource = data;
}
}
public class mapping
{
public int index { get; set; }
public string album { get; set; }
public string track { get; set; }
public string artist { get; set; }
public GeoCoordinate pos_lat { get; set; }
public GeoCoordinate pos_lon { get; set; }
public string nickname { get; set; }
}
<Microsoft_Phone_Controls_Maps:Map Height="427" HorizontalAlignment="Left" Margin="12,6,0,0" Name="map1" VerticalAlignment="Top" Width="438" />