Tag Archives: Silverlight

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 [...]

Animating multiple transforms in C# - Silverlight

Yesterday I talked about how to write C# code to animate multiple transforms of an object.  It appears, to my dismay, that at the current time you are unable to animate objects completely in C#.  There is a work around by creating a XAML storyboard and importing into a string using the XAMLReader object.  Here [...]

Resize Silverlight 1.0 app to size of browser

OK, this is pretty simple, but I thought I would post if (at the very least for my reference).
Problem: How do I make the Silverlight application the size of my browser?
Solution:

Add this line to the Page_Loaded event
BrowserHost.Resize += new EventHandler(BrowserHost_Resize);
Add this to the code behind file
void BrowserHost_Resize(object sender, EventArgs e)
{
Width = BrowserHost.ActualWidth;
Height = BrowserHost.ActualHeight;
}
(You may [...]

Downloader object

What is the Downloader object and what can it do?
This is one of the first questions I ran into while exploring Silverlight.  This object will retrieve objects (images, video, xaml) asynchronously, much like AJAX.  There is a gaping limitation being that it cannot go cross domain. 
To get around this take a look at Peter Kellner’s [...]