Tuesday 24 March 2009

Silverlight 3 Released

Silverlight 3 Beta was announced at the MIX 09 event in Las Vegas. The new version pushes the envelope in providing richer online applications through its various new features, controls, and methods of development. Some of the great Silverlight 3 features include the Out-Of-Browser experience, Search Engine Optimization, and improved graphic support. In this article, I will show you some of the cool features from Silverlight 3.

Developer Version

The current version of Silverlight 3 Beta is intended for developer use only. This means that you will need the Developer runtime to view Silverlight 3 applications. There is no “Go Live” support and not intended for public viewing. The end user runtime will be available later this year. Developers will need to ensure that they define the install experience in an appropriate manner to inform the end user that the application is in the beta stage. Tim Heuer wrote a great blog article about the Silverlight 3 Install Experience.

Let’s Get Started

Before you start developing in Silverlight 3, you will need to be aware that this is a Beta version and must treated as such. Silverlight 2 applications can be viewed, but not developed, with the new runtime. If you plan on developing Silverlight 3 applications, it is recommended to install Silverlight 3 on its own machine or virtual machine. Once you have installed Silverlight 3, you won’t be able to deploy Silverlight 2 applications on the same machine.

The following tools are the bare minimum needed to develop Silverlight 3 applications:

For more information on getting started with Silverlight, check out the Microsoft Silverlight 3 Site. The site includes the necessary tools, tutorials, and information to rapidly get you started.

Silverlight Toolkit

During MIX 09, the Silverlight Toolkit March 2009 was released with additional controls. One of the major change in the new Toolkit is the move from Microsoft.Windows.Controls to System.Windows.Controls namespace. The Toolkit includes two new themes: BubbleCreme & TwilightBlue. Some of the great new controls in the Toolkit include the Accordion and DomainUpDown. The Accordion control stores a list of collapsed and expanded AccordionItem controls. This concept is similar to a grouped collection of Expander controls, which allows you to organize data or XAML elements in a clean manner. The DomainUpDown control allows the user to cycle through a list of values using the TextBox and Spinner controls.

To learn more about the new features, check out the Silverlight Toolkit Breaking Changes.

New Controls

Silverlight 3 is shipped with new controls, along with a mature set of controls from Silverlight Toolkit. Some of the mature controls from Silverlight Toolkit include DockPanel, WrapPanel, Label, TreeView, Expander, and DataGrid. If you have used any of these controls in older applications, they will still work with Silverlight 3. Silverlight 3 also utilizes new controls for data, search engine optimization, and overall development.

Two new Data controls, DataForm and DataPager, can be used to render data in Silverlight applications. The DataForm control displays data for a single entity and allows for traditional data manipulation, including edit and update. The DataPager control allows the navigation through a data set.

Silverlight 3 introduces the navigation framework (System.Windows.Control.Navigation), which is composed of the Page and Frame controls. The Frame control hosts a single Page control utilizes the Navigation APIs to allow the user to navigate between the pages. The Page control resembles the commonly used UserControl control to hold the contents of the respected page. This feature allows you to create applications that resemble a web page using a single xap file. The primary benefit of the framework is the ability to communicate with the browser in regards to the Address Bar and Browser History. The currently loaded XAML file is stored in the Address Bar, which allows for deep linking in Silverlight applications and providing SEO. The framework also maintains the history of navigated pages, which can be access using the browser’s back and forward functionality.

The ChildWindow control makes its way to Silverlight 3. Child Windows, also known as modal windows, are used to draw attention to important information or to halt the application flow for user input. The child window blocks the workflow until the window is closed. The window stores the result in DialogResult to inform the application of its status upon closing. Unlike the traditional modal window, Silverlight renders the child window with an animation sequence and renders an overlay background to ensure the user focuses on the window.

Graphic Enhancements

Silverlight 3 sports significant graphical enhancements including 3D perspective transforms, pixel shaders, GPU acceleration, and animation easing. The new version also has a Bitmap API for manipulating bitmap pixels.

Perspective Transforms in Silverlight 3 is the next step towards developing 3D Silverlight applications. In previous versions of Silverlight, transforms were processed in the X and Y axis using the UIElement’s RenderTransform property. Silverlight 3 uses the PlaneProjection class to render 3D-like effects by applying content to a 3D plane. All elements, that derive from UIElement, have the Projection property that allows the element to simulate translation and rotation transformations in a 3D space. This feature allows for 3D-like user interfaces, flipping animations, and transition effects.

Silverlight 3 has two built-in effects, Blur and DropShadow, and supports the development of custom effects. Pixel Shaders are a compiled set of software instructions that calculate the color of the pixels and executed on the GPU. The instructions are written in HLSL (High Level Shader Language). All elements, that derive from UIElement, have the Effect property that allows the element to render with the connected pixel shader. This feature allows for more rich and beautiful user interfaces and transition effects.

GPU hardware acceleration reduces the CPU processing workload by performing the tasks directly on GPU hardware. This allows for full screen HD renderings of video to run on your computer without taking up a large load of CPU. GPU rendering can also be used to cache XAML and image elements.

The animation system has been upgraded with Easing functions to provide more natural and advanced animation. Developers can create their own custom easing functions by modifying the built-in function or deriving from the EasingFunctionBase. Silverlight 3 comes with several built-in easing functions, including the following:

  • BackEase
  • BounceEase
  • CircleEase
  • CubicEase
  • ElasticEase
  • ExponentialEase
  • PowerEase
  • QuadraticEase
  • QuarticEase
  • QuinticEase
  • SineEase

The Bitmap API allows rendering XAML elements and data to bitmaps using the WriteableBitmap class. This can be used to modify images, capture a frame from a MediaElement control, and render the current state of a control.

Media Support

Silverlight 3 adds support for additional standard media types, including H.264 and AAC, and supports third party codecs to decode outside the runtime and render in the Silverlight application. This allows for a wide variety of video and audio files to be played in Silverlight. Using GPU hardware acceleration, applications can now deliver full-screen HD content.

Themes and Styles

Silverlight 3 improves the themes and styles system to allow designers and developers to customize the look and feel of their applications. Unlike previous versions of Silverlight, Silverlight 3 supports changing styles during runtime. Styles can be stored externally in resource dictionary to allow for organized and shareable code. This allows developers to easily share and merge their styles among different projects. Styles now support an inherited system to reduce necessary code for redundant styles.

Out of Browser Experience

Silverlight applications can run outside of the browser with simple modifications by the developer. The end user can choose whether to install the application on the user’ Start menu and Desktop. One major benefit is that the end user can run the application at home, at work, and on the go without the need of a web browser and online access. Installed applications can be automatically updated to ensure that the end user has the latest version. The new Network APIs allows the application to know whether the application is connected or not.

Element to Element Binding

Element to element data binding allows you to bind element properties to each other. In previous versions of Silverlight, this would require more work on the code side because the element would fire its changed method and have that update the necessary elements. Silverlight 3 simplifies this process by performing the task directly in XAML.

Conclusion

Silverlight 3 has a lot of fantastic features to create the next generation of interactive applications. This article has only scratched the surface on the Silverlight 3 features. For more information on Silverlight 3, check out http://silverlight.net/getstarted/silverlight3/default.aspx. Additional information on Silverlight 3 can be found on the many MIX 09, which can be viewed at http://sessions.visitmix.com/MIX09/.

No comments: