Silverlight Digg search example

I’ve decided to follow Scott Guthrie’s Silverlight example for creating a Digg Search application. It’s a nice example covering a number of topics, however…there are a few gotcha’s (problems) in it.
  1. The tutorial involves a number of swaping one element type for another, the compiler can get easily confused. You can get weird errors that reference the old element when it is nowhere to be found in the source code. It seems that stepping though the initialize code seems to solve this!??
  2. The data control in the tutorial is called Data:DataGrid, for me it’s my:DataGrid
  3. Part of the tutorial explains how to separate style from structure, however a number of the controls the tutorial uses don’t support styles as resources. However, if you download the sample code you’ll see that Scott has replaced those with more basic versions, for example the tutorial uses a WatermarkTextBox (doesn’t support resource styles) whereas the sample code uses a straight forward TextBox.
  4. The tutorial shows the application displaying images, and indeed it does show how to bind to the thumbnail image. However, neither the tutorial or the sample code actually displays images. The problem seems to be that the Linq query is trying to store an entire Xml element into a string, doesn’t work. So you need to change the Linq query from

    Thumbnail = (string)story.Element("thumbnail"), to Thumbnail = (string)story.Element("thumbnail").Attribute("src"),

  5.   Binding the Hyperlinkbutton directly to the string href of the story class doesn’t work, it needs to be a URI. So add a URI property to the story…

public Uri HrefUri{get{return new Uri(this.HrefLink);}}

 
Advertisements
This entry was posted in Silverlight. Bookmark the permalink.

One Response to Silverlight Digg search example

  1. John says:

    Thanks for #5.  I worked through the same tutorial, trying to not look at the final source to get up to speed on doing some Silverlight.  I couldn\’t figure out why the href wasn\’t working so your solution was the missing link.
     

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s