Microsoft Silverlight

Releases

Version Name Version Number Release Date
1.0 CTP 1.0.? December 2006
1.0 RTW 1.0.20816 2007-09-05
2.0 Pre-Release
(As 1.1 Alpha Refresh)
1.1.20926.0 2007-09-05
1.0 service release 1.0.21115.0 2007-11-20
1.0 service release 1.0.30109.0 2008-01-15
2 Beta 1[15] 2.0.30226.2 2008-03-05
1.0 service release[16] 1.0.30401.0 2008-04-08
2 Beta 2[17] 2.0.30523.6 2008-06-06
2 RTM[18] TBA Late summer, 2008

Silverlight 1.0

A Silverlight 1.0 application hosted in Internet Explorer. Interactivity is provided by Silverlight, but user input controls are HTML controls overlaid on top of Silverlight content 

Silverlight 1.0 consists of the core presentation framework, which is responsible for UI, interactivity and user input, basic UI controls, graphics and animation, media playback, DRM support, and DOM integration.It is made up of the following components:

  • Input – handling input from devices like keyboard, mouse, stylus etc.
  • UI core – managing rendering of bitmap images (including compressed raster images like JPEG), vector graphics, text and animations.
  • Media – playback of MP3, WMA Standard, WMV7, WMV8 and WMV9/VC-1 streams.
  • XAML - to allow the UI layout to be created using XAML markup language.

A Silverlight application starts by invoking the Silverlight control from the HTML page, which then loads up a XAML file. The XAML file contains a Canvas object, which acts as placeholder for other elements. Silverlight provides various geometrical primitives like lines, ellipses and other shapes, to elements like text, images, and media etc. The elements are properly positioned to achieve the desired layout. Any arbitrary shape can be created as well. These elements can be animated using Event triggers; some animation effects are predefined, others can be created as composite of the pre-defined effects. Events like keyboard or mouse movements can also raise Events which can be handled by custom scripts.

Programmatic manipulation of the UI is achieved by using scripting languages to modify the Document Object Model of the Silverlight Canvas object.To facilitate this, Silverlight exposes a DOM API, accessible from any scripting language supported by Silverlight, which in version 1.0 release is limited only to JavaScript running in the browser. However, there are no UI widgets built in. The native widgets of the browser must be overlaid on top of the Silverlight Canvas for user input. Support for data formats is limited to POX (Plain Old XML) and JSON only.

Silverlight 2

Silverlight 2 (previously referred to as version 1.1)includes a version of the .NET Framework, implementing the same full Common Language Runtime version as .NET Framework 3.0; so it can execute any .NET language including VB.NET and C# code. Unlike the CLR included with .NET Framework, multiple instances of the CoreCLR included in Silverlight can be hosted in one process. With this, the XAML layout markup file (.xaml file) can be augmented by code-behind code, written in any .NET language, which contains the programming logic. It can be used to programmatically manipulate both the Silverlight application and the HTML page which hosts the Silverlight control. The XAML markup as well as the code, is compiled into .NET assemblies which are then compressed using ZIP and stored in a .xap file.

Silverlight ships with a lightweight class library which features, among others, extensible controls, XML Web Services, networking components and LINQ APIs. This class library is a subset of and is considerably smaller than .NET Framework's Base Class Library. Silverlight code runs in a sandbox which prevents invoking platform APIs. Silverlight 2 also adds support for adaptive streaming of media files (which allows Silverlight to choose the bit rate of the media based on available bandwidth) as well as Windows Media DRMand PlayReadyDRM in media files.

The version of .NET Framework in Silverlight add a subset of WPF UI programming model, including support for shapes, documents, media and animation objects of WPF. Beta 2 onwards, it ships with more than 30 UI controls (including TextBox, CheckBox, Slider, ScrollViewer, and Calendar controls, among others),supporting two-way databinding support, automated layout management (by means of StackPanel, GridPanel etc)as well as data manipulation controls such as DataGridand ListBox. UI controls are skinnable using a template-based approach.Third party libraries for expanded sets of UI controls are also available.
Silverlight 2 Architecture 

The included Base Class Library (BCL) provides classes for collections, reflection, regular expressions, string handling and data access. It also supports LINQ, with the full support for LINQ to Objects and expression trees. Almost all of the System.LINQ and System.LINQ.Expression namespaces are exposed. However, LINQ to XML is not present in the Alpha release; it debuted with the beta 1 release. Beta 2 added LINQ to JSON to run LINQ queries directly on JSON data. It also supports serialization of objects, for data persistence. Silverlight can handle data in either RSS, POX, and JSON formats, in addition to XML. The BCL provides enhanced support for working with XML data, including the XMLReader and XMLWriter classes. Silverlight 2 also supports asynchronous programming via the use of the threading libraries.

Silverlight also includes classes for data access over XML-based Web services (POX), REST, WCF Services and ADO.NET Data Services.The networking support in Silverlight can be used by Silverlight applications to communicate over HTTP. While in the alpha release of Silverlight 2, cross domain communication is not allowed,the beta 1 release adds support for the same. Silverlight 2, starting from Beta 1 release, also adds support for network communication using sockets, over both IPv4 and IPv6.Beta 2 onwards, sockets can be used for cross domain connections as well.Silverlight uses an XML-based configuration file to control the cross-domain resource access policy, both for HTTP connections as well as socket connections. It can be used by site administrators to control which resources a Silverlight application, that did not originate in the domain of the site, can access. In addition, Silverlight also supports the Adobe Flash cross domain policy file format. Silverlight sockets can only initiate a connection; they cannot listen for connections.

A Python interpreter in Silverlight 2 hosted in Mozilla Firefox 

Silverlight 2 includes the Dynamic Language Runtime (DLR) which allows dynamic compilation and execution of dynamic (scripting) languages. Compilers for the languages based on the DLR (including IronPython and IronRuby) are be packaged with the DSL app in the .xap package. The DSL SDK includes a web server named Chiron that can dynamically package all the dependencies for the DSL application and serve it to the browser. The first upcoming languages written for the DLR are Managed JScript, IronPython 2.0, and IronRuby. Microsoft also plan to build Visual Basic .NET 10.0 (VBx) on the DLR. All four languages share the same infrastructure to allow Silverlight to compile and execute the language source. Conversely, other .NET languages must be compiled ahead of time and delivered to Silverlight as .NET assemblies. The implementation of Managed JScript conforms to the ECMAScript 3.0 specification, and Microsoft claims that it is 250 times faster than interpreted JScript.

With the integration of .NET Framework, Silverlight also allows HTML-managed code interaction, which allows manipulation of HTML DOM elements from managed code,as well as allow JavaScript code to call managed code and use objects instantiated by managed code. Silverlight encloses JavaScript objects and DOM elements in managed wrappers to make them available from managed code. However, in the 1.1 alpha release directly calling JavaScript code is not implemented, but managed code events can fire JavaScript handlers. A Silverlight instance does not need to have a UI component in order to manipulate the HTML DOM from managed code.It is done by creating a XAML Canvas with its width and height set to zero, and using its code-behind code to modify the Document Object Model of the HTML page via the APIs in the System.Browser namespace.

A Silverlight 2 application using DeepZoom running in Safari 3.1 on Windows XP 

Silverlight 2 includes Deep Zoom, a technology derived from Microsoft Live Labs Photosynth. It allows users to zoom into or out of an image (or a collage of images), with smooth transitions, using the mouse wheel.[38] The images can scale from 2 or 3 megapixels in resolution to gigapixel range, but the user need not wait for it to be downloaded entirely; rather Silverlight downloads only the parts in view, optimized for the zoom level being viewed. Beta 2 onwards, Deep Zoom uses an XML-based file format.

Silverlight 2 also allows limited filesystem access to Silverlight applications.It can use the operating system's native Open file dialog box to browse to any file (which the user has access to). The file is sanitized of path information to prevent the application from getting access to information like user name and can be opened only in read-only mode. For local storage of data, Silverlight provides isolated local storage (isostorage), which is stored, outside the browser cache, in a hidden folder inside the user profile's private folder. It is by default set to 1 MB per URL,but can be changed by the user.Data stored by a Silverlight application in the isostorage is identified by the URL that it loads from, can be accessed by that application only. All instances of Silverlight share the same isostorage, so all instances of the same Silverlight application can share the saved data, even if they are running on different browsers.

Silverlight CoreCLR uses an attribute based security model, as opposed to the Code Access Security (CAS) model of the desktop version of .NET Framework.All assemblies are marked with a security attribute, which can be either transparent (SecurityTransparentAttribute), safecritical (SecuritySafeCriticalAttribute) or critical (SecurityCriticalAttribute). Methods in transparent assemblies runs with partial trust, and any code in such assemblies cannot call critical methods. They also cannot contain unverifiable code (use the unsafe C# keyword or use pointers) or invoke system functions by means of P/Invoke. Code in both critical and safecritical assemblies run with full trust, and are not subject to such limitations. However, critical methods can only be called from safecritical methods and not transparent methods. Thus transparent methods are prevented from using methods that can cause system wide changes. Instead, they have to call safecritical methods which will verify that the call is safe and within the limited rights of the caller, and then proxy it to the critical methods. In fact, the IsoStorage APIs are exposed as safecritical methods. An assembly that does not have any attribute set is run as a transparent method. The limitations also apply for type inheritance, virtual method calls and interface method calls as well.Silverlight assemblies can contain members that are not usable by CoreCLR but can be by .NET Framework CLR; such methods will not be loaded when the assembly is being executed by CoreCLR.

However, only platform code is allowed to be marked as Critical or SafeCritical. The Silverlight runtime ensures that platform assemblies are loaded only from the Silverlight installation directory, and are signed by Microsoft. This effectively means that all user application assemblies can only be transparent code and run under partial trust and limited rights.Platform code can be marked with either attribute. The BCL methods of the .NET Framework, which have the Internet attribute set allowing them to be called from untrusted code originating from Internet, are exposed in Silverlight BCL as transparent methods.