Simple Silverlight 2 app - APIDemo - Part 1, Building the DiggSample

Scott Guthrie published an eight step Silverlight 2 Beta 1 tutorial. The page that links to all eight parts and explains how to get started is Get Started Building Silverlight 2 Applications.

I did not even really understand what Silverlight is, so decided to get my feet wet with this very basic tutorial. I followed the first two or three tutorials religiously, typing in the code and experiencing a bit of how it works. Then I read the remainder pretty carefully and downloaded the complete demo application at the end.

Scott's demo application performs a search of the Digg api and displays selected parts of the xml returned.

Digg.com has a pretty cool set of Digg APIs that they publish over HTTP.  Because they have a Flash cross-domain policy file in place on their server, we can call them directly from our Silverlight Digg client application (and not require us to tunnel back through our web-server to reach their APIs).

FeaturePics.com has recently published a Developers API, and I have not yet seen the code used in an application, so I hit on the idea of modifying Scott's demo app to provide a FeaturePics API demo. So that was what I set out to do.

Version Issues

When I tried to compile the downloaded Digg demo app there were a few changes necessary due to the Silverlight on my computer is Beta 2 and the code is for Beta 1. Probably the most difficult of these to resolve was the WatermarkedTextBox control could not be found. Google found Kathy Kam, Reflection on the CLF and .NET.

One breaking change you may have noticed between Silverlight 2 Beta 1 and Beta 2 is that WatermarkedTextBox is no longer available in the Silverlight SDK (System.Windows.Controls.Extended.dll). 

We decided to remove the control because in a future version of Silverlight, we will be adding a “Watermark” property to TextBox. Given this upcoming change, it does not make sense to have "WatermarkedTextBox" as a separate control, so we decided to remove the control from Silverlight 2.

Because the update to TextBox will not happen until a future version of Silverlight feel free download and use the WatermarkedTextBox source code and unit test in the mean time. By downloading the source and unit tests you accept the license.

Here is an example on how to use it:

image

So I downloaded the referenced project, built it, and referenced it in DiggSample, which produced an immediate error because I had previously referenced the System.Windows.Controls.Extended that is included in Beta 2. Possibly I could have just removed that previous reference, but instead I renamed the download project to Extended2. Then I added the following line to the controls definition, and the app compiled.

xmlns:wtb='clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Extended2'

I happen to have available a couple of vacant domains and I used one of them DiggSample, Beta 2 Version. The search is for Digg Topics only, so try something like football or soccer. 

16. August 2008 12:53 by Kal | Comments (0) | Permalink
Comments are closed

Calendar

<<  December 2020  >>
MoTuWeThFrSaSu
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

View posts in large calendar

Month List