I’ve written about Silverlight in previous posts published on this blog. Recently, however, I’ve found my thoughts coming back to this subject. This is hardly unusual: many people are interested in Silverlight.
The reason for the attraction to this technology is not hard to discover. Silverlight allows us to build visually appealing web applications with a sophisticated, well designed programming language such as C#. Though there are now many sophisticated tools for creating web applications, but most of them still depend on fragmented models that force us to integrate multiple, hard to use technologies into a patchwork design that is poorly integrated. Applications built on these models can be hard to debug, and hard to maintain. They also lack the ability to easily support rich interfaces that would be taken for granted in a desktop application.
I’ve spent most of my programming career working in either Delphi or C#, and I have a huge respect for the elegance of these languages, and in the power of object-oriented design to help us break complex problems into manageable, easy to maintain solutions. It is, of course, easy to create poorly designed C# programs. Nevertheless, I believe that C# in particular and Silverlight in general has the capacity, the potential, to support elegant solutions in a way that many web technologies do not.
In short, I’m interested in Silverlight for two reasons:
- It allows me to create a rich interface with sophisticated visual techniques including animation.
- It provides a thoroughly modern programming model, and a set of rich API’s for performing common programming tasks.
So there, whether one agrees with me or not, is my motivation to revisit Silverlight. Once I had found my inspiration, my next step was to visit the Silverlight site, and download the tools to integrate Silverlight into Visual Studio 2008. The installation worked smoothly on a copy of XP that I had running in a virtual machine. Though I haven’t done it yet, I also intend to download Expression Blend.
Once I had a set of Silverlight tools integrated into Visual Studio, I set about experimenting with them. After a bit, I came up with the application shown in Figure 1. Not bound by such quotidian obligations as having a practical purpose, or a pleasing interface, it didn’t take me long to put this program together. It’s only redeeming feature was that it gave me a chance to experiment with several Silverlight technologies including:
- XAML and WPF
- A tool called a StackPanel, which helped me organize the interface, which consists primarily of simple controls such as buttons and text areas.
- Two different types of Canvases on which I could I draw.
- Several different graphical shapes and paths, as well as the Ink technology handed down from Tablet PC.
- A simple LINQ query.
Figure 1: A simple Silverlight program, running in the Internet Explorer, which demonstrates how to use several key technologies.
In my next post, I’ll talk some about the code for this application, and describe how its various parts fit together. Overall, I found putting this code together was blessedly simple, and overall quite a bit of fun. At least from what I’ve seen so far, one of Silverlight’s great strengths is its ease of use.