Monthly Archives: March 2008

Consume a JSON object in Silverlight

Here is how to consume a JSON object in Silverlight 2.

Start with a JSON object:
var Person = {
“firstName”: “John”,
“lastName”: “Smith”,
“address”: {
“streetAddress”: “21 2nd Street”,
“city”: “New York”,
“state”: “NY”,
“postalCode”: 10021
}
}
Create an entry point into Silverlight. You will need to add namespace System.Windows.Browser.

Next add C# classes to mirror the JSON object. It’s important to make sure [...]

How to dynamically create animations from C# in Silverlight

So you want to create an animation from managed code. To do this, there is quite a bit of code needed. For every animation there needs to be a new StoryBoard, and unfortunately a StoryBoard can not be reused between objects. (Correction: You can reuse a dynamically created StoryBoard. Make sure to [...]

Register XAP file extention in IIS

If you are having problems loading a Silverlight 2.0 application, and you have exhausted all options, you may need to register the XAP file extension in IIS. I banged my head against the wall (well, not really) trying to figure out why my application wasn’t loading. It turns out to be a simple [...]

Why won’t media play in Silverlight 2?

The Media Element handles errors pretty gracefully. The errors that do occur are usually related to cross domain problem and setting the Source from managed code.
If you are experiencing errors, make sure to take a look at the address bar. If the site is being run from the local file system and you [...]