Silverlight
Overview
Silverlight enables development of the next generation of Microsoft .NET-based media experiences and rich interactive applications (RIAs) for the Web. Silverlight is delivered as a cross-platform and cross-browser plug-in that exposes a programming framework and features that are a subset of the .NET Framework and Windows Presentation Foundation (WPF).
Support
The industry has been aware of Silverlight since the beginning of 2007 when Microsoft began demonstrating its power at developer conferences. In fact, no other development technology has been so highly anticipated since the arrival of the .NET Framework. To spark developer interest in Silverlight, Microsoft launched several community Web sites dedicated to Silverlight development including the Silverlight home page (http://www.microsoft.com/silverlight) and the Silverlight.net community Web site (http://silverlight.net).
Architecture
Unlike ASP.NET, the bulk of Silverlight processing occurs on the client machine thus decreasing server resource utilization and improving the Web experience on the client. The figure below shows the difference between ASP.NET processing and Silverlight processing:

When a client initially attempts to run a Silverlight application, if the Silverlight plug-in has not been installed on the client machine, it will be downloaded and installed. Upon subsequent requests to run the application, the application will instantiate on the client machine and make requests for resources from the server only when necessary. The Silverlight plug-in can be thought of as a scaled-down version of the full .NET Framework. It only contains those classes and functionality that are applicable to a Silverlight Web client and those were streamlined and optimized for use on the Web client machine.
Silverlight was designed using the same design paradigm as ASP.NET. Each page of a Silverlight application includes an associated code behind file that includes the code that handles events fired by the page. Silverlight resembles WPF in that it uses Extensible Application Markup Language (XAML) to construct the user interface (presentation layer). As Silverlight applications are composed of text-based files that include markup and code, they can be created using any text editor; however, more advanced tools and development environments such as Visual Studio or Expression Blend simplify the task significantly.
Hosting
Microsoft Silverlight functionality is completely encapsulated within the Silverlight plug-in. Web applications typically require the server hosting the Web application to meet minimum requirements. Silverlight applications simply require a Web server to be equipped as they would be for hosting HTML documents. Silverlight applications can be hosted on any Web server accessible to the target audience. The two most commonly used Web servers are Microsoft Internet Information Server (IIS) and Apache.
Executing a Silverlight application on a Web client machine is a two step process. First, the application will detect if the Silverlight plug-in is installed on the Web client machine. If the plug-in is not installed, the user will be prompted with an option to download the plug-in. If the user opts to do so, a request will be made of the Web server to download and install the plug-in. The Silverlight plug-in is embodied in a .dll executable file that is loaded into the Web client browser memory once installed. The only interaction required by the Web client when installing the Silverlight plug-in is to grant permission for the plug-in to be installed. Various Web servers, including Microsoft Internet Information Server (IIS), may require slight configuration modifications so that the Silverlight executable file will be downloaded to the Web client when requested.
Second, once the Silverlight plug-in is installed on the Web client machine, the Silverlight application itself must be downloaded. A Silverlight application may consist of many types of files. Slight configuration modifications may be necessary on the Web server, such as MIME types, so that XAML and XAP files are associated with Silverlight and downloaded correctly to the Web client machine when requested.
Once the Silverlight plug-in is installed on a Web client machine and a Silverlight application is downloaded, the Silverlight application is then hosted on the Web client machine. There are some requirements necessary for the Web client machine as discussed in the sections below, however all media players, audio and video codecs, compilers and the runtime are encapsulated in the Silverlight plug-in.
Platforms
Silverlight can be installed on Windows and Macintosh machines. Silverlight applications run within the confines of a plug-in. There are many benefits to using a plug-in with the primary benefit being consistency across implementations. A plug-in application can provide a consistent result in every instance where it is supported. Other plug-in solutions, such as Adobe Flash, have become popular due to consistency across implementations. For instance, a plug-in application should deliver a consistent result regardless of whether it is displayed using Internet Explorer on Windows or Safari on a Macintosh.
New Features in Silverlight 3
DataBinding
- Element to Element Binding – enables property binding to CLR objects and other UI components via XAML.
- Data Validation
- facilities to validate data via two way databinding
- provides skinnable control which allows designers to specify an error call-out
- built-in support for commonly used controls such as TextBox, CheckBox, etc.
Styling
- Based on Styles – a new feature widely used in WPF – provides ability to have styles based on other styles. This is also known as “cascading” for those who are familiar with CSS.
- Resetting Styles – in Silverlight 3 is possible to set a Style multiple times. That helps for easier skinning of your application.
- Merged Resource Dictionaries – this feature allows you to use externally defined resources. A widely used scenario here is to share same resources between different applications.
Offline support
Out-of-browser applications allow you to take you application offline, put links to it on user’s desktop and/or start menu and access local data within user’s documents.
Controls
Part of the controls included in the Silverlight Control Toolkit now are also part of the Silverlight SDK:
- WrapPanel
- DockPanel
- ViewBox
- AutoCompleteBox
- TreeView
- Label
There is also one new control included:
- FileSaveDialog – gives users the opportunity to save files to their computers.
Another great feature added in Silverlight 3 is the multiselection in the ListBox – this allows the user to make multiple selections.
Caching
The Silverlight browser plug-in by itself is around 4.6mb. As it develops and provides more and more built-in features over the time it is important to retain a small core runtime. Adding assemblies from the SDK or other third party ones makes the deployment package (the XAP file) bigger and that affects the end users. To deal with this problem Microsoft now cache locally (on user’s machine) framework assemblies on first use. Sounds cool, but personally my hope is to start caching not only assemblies that are part of the framework, but also a third party ones. For example if I use the Telerik or DevExpress Silverlight controls then it would be awesome if Microsoft also caches their assemblies. Pushing third party dlls in your XAP makes it really large and time consuming to download.
Another caching feature of the new Silverlight is the so called Cached Composition. It renders a visual tree of a set of elements to a bitmap and then uses the bitmap to render. This can greatly improve the graphics performance because in this way the element tree is rendered only once.
Animation
- Easing – mathematical functions that describe an animation. Animation Easing functions makes it a lot easier to animate your objects with realistic behavior. There are a number of built-in effects such as Elastic, Bounce, Circle, Cubic and more.
- Text Animation – a new option allows you to disable readability optimizations (such as Clear Type, anti-aliasing) while animating text. There is really no point in using anti aliasing while you are animating some text –it just slows down the performance.
Graphics
- Bitmap API – allows the developers to write to the pixels of a given bitmap. That makes it possible to create a basic photo editor functions such as red eye correction, blur or fish eye effects.
- Pixel Shader Effects – the long-dreamed blur and drop shadow effects. Developers can also write their own pixel shader effects using a special shading language called HLSL.
- Perspective 3D – one of the most exciting features available in the new release – allows perspective transforms that can be applied to any XAML elements to simulate rotating or scaling in the 3D space.
- Hardware composition – support for GPU to draw on screen. This can hugely improve the performance of full screen video and bitmaps.
Deep Zoom
- Enhanced performance - you are now able to show collections of a few thousand items with highframerate thanks to the Silverlight 3's hardware acceleration
- Status information - you can provide status information when an image is completely downloaded
- The MultiscaleImage control is now able to show different views of the same data using multiple DeepZoom images. For example one of the images displays the entire scene, and the another focuses on just one object.
Media
H264 and RAW support – provided ability to playback H264 and AAC content. Now it is also possible for developers to write their own codec to stream audio and video.
True HD playback in fullscreen
Text Support
- Compressed fonts – now you can ZIP fonts and load them in your app.
- Support for local fonts – you can now make use of local fonts installed on user’s machine.
- TextBox’s caret is now styleble – there is a CaretBrush property on both TextBox and PasswordBox making it possible to style the caret on those controls.
Networking
- Network change detection – with the ability to go offline with your application you will sometimes need to know whether you are connected to the internet or not. There is a handy event and a property to understand that and to detect a change in the connection.
- Local connection – allows client-side communication between two or more Silverllight applications. This is useful when you have more than one Silverllight controls on a given web page and you want to be able to establish a connection between them.
- Binary XML – to improve the performance on your WCF services now you can compress the data being transmitted by using a binary XML instead of using a regular textual one.
Accessibility
The Silverlight plug-in now provides access to all system colors. This lets partially sighted people to make changes such as high contrast color schemes for readability using familiar operating system controls.
Conclusion
Silverlight has been improved with each new version. I use Microsoft technologies to build business applications. Silverlight is almost at the point where it makes sense building business applications in Silverlight, but not quite. My hopes are that once the next version of Visual Studio .Net is released that all the loose ends will be tied up. Those loose ends now include a good definition of roles and authentication between pages and quickly adding and using stored procedures in RIA which is currently in Beta. There is no doubt that Microsoft will get Silverlight to the point where it is in the mainstream.