Here’s my first Silverlight 1.1 (which has .NET support) app. It bounces various shapes around the canvas. (Stop laughing! )
I didn’t know how to host a SL 1.1 control on this blog server, so I hosted it at my own server here. Here’s a screenshot (click on it to go to the actual page and see it in action):
You obviously need to download Silverlight 1.1 for this to work, but the download is very easy, fast (< 30 seconds), and actually works. The silverlight install is orders of magnitude better than the desktop install; there’s been a lot of of effort into getting it right.
FWIW, it’s also my first Xaml app. Working on debugging APIs doesn’t exactly give you lots of opportunities to play with the current UI technologies. The prior GUI stuff (like the GUI for Mdbg) I’ve done has been with WinForms and a very tiny bit with win32.
How does it work?
The page has links to the C# and Xaml code if you’re interested in seeing how any of it was done.
The bouncing shapes are .jpg images, which I proudly drew myself in mspaint.
The Xaml handles the layout and minor animations that can be described in a declarative manner (such as the rotations and stretching). The ambient animation and opacity are basically freebies with Xaml, and that’s just scratching the surface of what’s available.
The C# code handles the bouncing logic, which is a tad more complicated than a simple linear animation on a property. It sets up a timer callback, and then the callback adjusts the image locations to do the animations. The timer callback needs to be on the UI thread so that I can adjust UI elements without cross-thread overhead. I used System.Windows.Browser.HtmlTimer for that. That’s marked deprecated, but I haven’t found an adequate replacement yet.
Looks like Silverlight1.1 doesn’t yet have a button, so the pause/resume button is a hacked up ellipse with OnEnter/OnExit/OnClick handlers.
It’s not exactly the most practical use of Silverlight 1.1, but a cute starter project. It doesn’t do anything fancy with Xaml, and it doesn’t take advantage of Silverlight’s cooler features like streaming media and richer rendering. I suppose I could throw some paddles in there and make it a pong game or something.