Chapter I: Introducing Silverlight

Posted by Apress Free Book | Silverlight December 04, 2008
Tags: silverlight
If you are already a .NET developer, you will be in familiar territory after learning XAML and its features. The correspondence of XAML to classes in .NET is a major strength, and the tool support built around XAML for designers and developers is strong and growing.

That is, unless the cross-platform aspect is obtained free or near-free (therefore helping to future-proof the application if the user base changes). This concept of "free or near-free" is important-software engineering is already a challenging endeavor, and if making software cross-platform is difficult to implement, it requires either significantly more development time for a single code base, or a second code base for a different platform that replicates the functionality of the first (not to mention a third or fourth code base if other platforms must be supported). Without question, this means more time, more money, and more development resources are needed. Optimally, we want a relatively easy way to create cross-platform applications. Fortunately, a number of frameworks have attempted to make the creation of cross-platform applications free or near-free.

Cross-Platform Frameworks

Frameworks for developing cross-platform applications are not new. Even the C language is  arguably cross-platform, since the source can be written once and compiled on each target platform, thus enabling portability of projects written in C. While arguments over what truly constitutes cross-platform can be interesting, they aren't of much practical use for us here, so let's take a brief look at the serious contenders for developing cross-platform applications.


Qt (pronounced cute) is a cross-platform application development toolkit mainly for C++; however, it has support for other languages such as Java. The significant benefit to Qt is that programs execute natively after compilation (i.e., no new virtual machine is needed). The cross-platform nature of Qt is provided at the source level, as long as developers utilize Qt's platform-agnostic API. The major downsides to Qt are the learning curve for developers and the degree to which applications might become intertwined with Qt (though this might be acceptable to many organizations). Visit for more information.

The Java Platform

The Java platform is possibly the closest comparison to Silverlight on the market. Much like .NET, the Java platform is a managed environment. Until Silverlight, though, .NET was only available on Windows. Both platforms provide the ability to compile a program and immediately execute it on multiple platforms. The Java platform and Silverlight approach this similarly: an execution environment (known as a virtual machine) is developed for each platform where programs might be run. Java source code is compiled to Java bytecode, which is then executed by the Java virtual machine. The downsides to this approach are the plethora of virtual machines that can be created, each with potential quirks that sometimes affect existing applications, and the time cost of starting up a Java virtual machine on a web site (you've no doubt seen the gray rectangle and the loading symbol on web pages). Sun also has a more direct competitor to Silverlight called JavaFX, a framework including a scripting language to more easily create Java applications. This framework makes the most sense for institutions and developers already used to working in the Java environment or needing to extend their existing Java applications.

Visit if you are curious about learning more.


Flash is, by far, the most popular comparison to Silverlight. A browser plug-in that enables execution of rich content for the Web-doesn't that sound familiar? This comparison is made even more explicit with Adobe releasing Flex, an environment for executing rich applications in the browser and on the desktop. While there are some feature differences between Flex and Silverlight that can make one more appealing than the other, Flex is a viable alternative to Silverlight; however, it caters to a different set of developers than Silverlight does. Flex capitalizes on the languages people already know, including JavaScript, HTML, CSS, and ActionScript. Silverlight, however, provides a brand new markup language, but is an incredibly natural platform to develop on if you're already a .NET developer. Visit if you want to learn more about Flex.


This brings us to the subject of this book: Silverlight 2.0. The .NET 3.0 Framework included the first release of WPF, along with other key technologies. With WPF came XAML, essentially a way to create applications in markup (there is an almost one-to-one correspondence between XAML constructs and code). While XAML is not necessarily tied to presentation logic, the two most visible uses of it are in WPF and Silverlight. Silverlight's implementation of XAML is a subset of WPF's-it does not have 3D support, for example. While Silverlight does contain a CLR, it has absolutely no dependence on any of the .NET Framework versions-the Silverlight plug-in brings with it a CLR and a base class library all its own.

If you are already a .NET developer, you will be in familiar territory after learning XAML and its features. The correspondence of XAML to classes in .NET is a major strength, and the tool support built around XAML for designers and developers is strong and growing.

Total Pages : 6 12345