WP7 프로젝트에서 원형 차트를 채우는 데 문제가 있습니다. 지금, 내 코드는 다음과 같습니다. xml 웹 서비스에서 데이터를 다시 가져 오는 몇 가지 다른 방법을 시도했지만 행운은 없습니다. 누구든지 내가 잘못한 것을 볼 수 있습니까?WP7 원형 차트를 채우는 중 문제가 발생했습니다.
오류가 발생했습니다. "암시 적으로 'System.Collections.Generic.IEnumerable'형식을 'System.Xml.Linq.XElement'형식으로 변환 할 수 없습니다. 명시 적 변환이 존재합니다 (캐스트가 누락 되었습니까?
이XElement Quota = XDocument.Descendants("traffic").Attributes("quota");
Descendants("traffic")
의 결과는 IEnumerable
아닌 XElement
이다) "내 추측이 줄은
XDocument XDocument = XDocument.Load(new StringReader(e.Result));
XElement Traffic = XDocument.Descendants("traffic").First();
XElement Quota = XDocument.Descendants("traffic").Attributes("quota");
ObservableCollection<PieChartItem> Data = new ObservableCollection<PieChartItem>()
{
new PieChartItem {Title = "Traffic", Value = (double)Traffic},
new PieChartItem {Title = "Quota", Value = (double)Quota},
};
pieChart1.DataSource = Data;
XML 파일의 모양은 무엇입니까? – devuxer