Hi im new to using Visual Studio and Silverlight im following a tutorial at the Micrsoft Learn Silverlight page ("
http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-3-using-networking-to-retrieve-data-and-populate-a-datagrid.aspx"). I have done evrerything to part 3. When i try to run my webapp i get the following error.
(The type or namespace name 'Linq' does not exist in the namespace 'System.Xml' (are you missing an assembly reference?))
I have tried adding reference to System.Xml and System.Xml.Linq but it´s not helpded. Can someone point me in the right direction what is wrong.
Code.
using System;
using System.Collections.Generic
;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Net;
using System.Xml.Linq;
namespace DiggSample
{
public partial class Page : UserControl
{
public Page()
{
InitializeComponent();
}
void Button_Click(object sender, RoutedEventArgs e)
{
//Retrieve topic to search
string topic = txtTopic.Text;
string diggUrl = string.Format("
http://services.digg.com/stories/topic/{0
})?count=2
0&appkey=h
ttp%3A%2F%
Fscottgu.c
om", topic);
//initiate Async Network Call to Digg
WebClient diggService = new WebClient();
diggService.DownloadString
Completed += new DownloadStringCompletedEve
ntHandler(
diggServic
e_Download
StoriesCom
pleted);
diggService.DownloadString
Async(new Uri(diggUrl));
}
void diggService_DownloadStorie
sCompleted
(object sender, DownloadStringCompletedEve
ntArgs e)
{
if (e.Error == null)
{
DisplayStories = (e.Result);
}
}
void DisplayStories(string xmlContent)
{
XDocument xmlStories = XDocument.Parse(xmlContent
);
var stories = from story in xmlStories.Descentandts("s
tory")
where story.Element("thumnail") != null
select new DiggStory
{
Id = (int)story.Attribute("id")
,
Title = (string)story.Element("tit
le"),
Description = (string)story.Element("des
cription")
,
ThumbNail = (string)story.element("thu
mbnail"),
HrefLink = (string)story.Element("hre
flink"),
NumDiggs = (int)story.Attribute("digg
s")
};
foreach (DiggStory story in stories)
{
StoriesList.ItemSource = stories;
}
}
}
}
Plz Help
Best Regards
Mattias
Start Free Trial