If you are based in the US and had a chance to experience Olympics 2008 over the web on http://nbcolympics.com – you probably saw some of the power of Silverlight for immersive media experiences. Silverlight 2 Beta 2 enables much more than media experiences so let us look at some of these aspects in detail .
Next, lets look at Controls. Silverlight ships with a rich and functional control set. For layout, the following controls are available – Canvas, Panel, StackPanel, Grid. Other feature controls include Button, Calendar, CheckBox, DataGrid, DateTimePicker, GridSplitter, Hyperlink, ListBox, Popup, Radio, Slider, Toggle, Tooltip and this list will continue to grow. Silverlight also has a strong partner ecosystem building domain specific controls. Another important aspect in using framework control is the ability to style and apply skins to the controls to get the desired rendering. Silverlight fully supports these mechanisms and shown below are examples of applying skins and styles to the TreeView control to change its look and feel. The first image is the normal rendering, the second image applies styling to change background and imagery and the final image shows the transformation of the Treeview control into a dial-based UI to highlight full control over the UI. There are also ASP.Net controls available based on Silverlight – such as MediaPlayer control and the XAML control.
Another important feature in this regard is the VisualStateManager which provides a notion of state and transition and supports visual transition along with minimizing state explosion. Silverlight also supports Animations – changing the value of a property over time, use different animation (double/color/point/object) and interpolating(linear/discrete/spline) types. Animations can be defined both declaratively and programmatically.
Another key aspect for Silverlight is Media. The key tenets for Silverlight in this space are – highest quality, lowest cost of operation, best overall user experience, and monetization. There is support for VC-1, WMV, WMA, mp3, and WMA 10 Pro. One of the most feature for media capabilities is the support for DRM, this is applicable for streaming content. The support for playlists allows for delivery of a set of assets to any user. The 3 primary types of playlist are
- .asx – resides on the client PC, simple to author and deploy, the urls are exposed to the client, ad content can be skipped
- .wsx – resides on streaming server, can hide location of assets from the client, seek/skip disabled
- .isx – web playlist, requested from web server which returns obfuscated urls for client playlist, location of assets remains hidden
An important aspect of any application is Data, so let us look at this in Silverlight 2. The first thing you will notice is LINQ support – in addition to LINQ to Xml and LINQ to objects, we now have support for LINQ to JSON. There is also support for in-memory filtering and sorting, compile-time syntax checking and 2-way binding support. DataTemplates are used for UI representation of data and can exist in Content controls or Item control. DataGrid is the main control for data and it supports data-binding, scrolling, row selection, text/template.checkbox columns, skinning, editing, resizable rows and columns, auto-sizing for rows and columns, frozen columns, filtering, detail view etc.
Finally a web application warrants a strong Networking support, so let us look at the Silverlight 2 networking features. One of the primary things to take note of is the WebClient – this supports asynchronous, cross-domain access to network assets. The HttpWebRequest and HttpWebResponse classes are also available and provide fine grained control of Http messaging. This allows to consume existing form-based assets. Silverlight supports WCF based services for consumption. SOAP-based web services can expose WSDL and deploy the x-domain xml and ClientAccessPolicy.xml to support access from other servers. Socket based communications require a policy server to be defined. The first handshake with the policy server determines which ports/protocols acceptable to connect.
One fun feature I wanted to touch upon to get everyone excited around Silverlight is DeepZoom – see it in action here (zoom-in and out to see the feature in action. This really provides a seamless viewing and zooming experience for large images or sparse images (more resolution in some parts of the image than others). The way this functions is to load only required data for showing a specific part of the image. The lowest resolution tiles are shown first and then higher quality tiles blend in. The DeepZoom composer tool can be used to transform regular images to multi-scale images so that these are ready for consumption.
Hopefully, this primer gets you to look at Silverlight more closely.