0
我目前正試圖建立在Windows Phone有點RSS閱讀器應用程序7.讀取多個RSS源
到目前爲止,我能夠在不同的全景圖顯示單一飼料和它工作正常。
但是在我的MainPage上,我想顯示來自多個RSS源的最新消息。
例如,我在不同的頁面上有feed1,feed2,我想在我的主頁上顯示來自feed1和feed2(或更多)的最新消息的標題。
這是我一直在使用我的單身飼料代碼
Mainpage_Loaded:
WebClient wc = new WebClient();
wc.DownloadStringAsync(new Uri("feed-goes-here"));
wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(wc_DownloadStringCompleted);
然後:
void wc_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
if (e.Error != null) return;
XElement xmlItems = XElement.Parse(e.Result);
listBox1.ItemsSource = from x in xmlItems.Descendants("item")
where x.Element("enclosure") != null && x.Element("description") != null
select new RSSitem
{
Description = x.Element("description").Value.Substring(0,100)+"...",
Title = x.Element("title").Value,
ImageSource = x.Element("enclosure").FirstAttribute.Value
};
}
我已經有很多的方法來測試解決我的問題,但仍然找不到答案。
所以我的問題是:我如何顯示在列表框上,從同一頁上的2個不同的飼料最近的新聞? 謝謝你的幫助和你的時間。
問題在哪裏? – onof 2012-02-14 15:25:26