Share via


What's New in Silverlight 5

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Silverlight 5 includes several new features that are based on customer suggestions. This topic introduces some of the new features and improvements in Silverlight 5.

This topic contains the following sections.

  • Controls
  • Media
  • Graphics
  • Text
  • Trusted Applications
  • Printing
  • User Interface
  • Data
  • XAML
  • Performance Improvements
  • Related Topics

Controls

PivotViewer

The PivotViewer control enables you to display a large amount of data at once in a way that is easily consumable by the user. Users can browse the data in such a way that helps them see the trends and quickly find information they need. For more information see, PivotViewer.

DrawingSurface

DrawingSurface is a new control in Silverlight 5. DrawingSurface defines an area where 3-D content can be composed and rendered. You implement the rendering behavior through the event data of the Draw event. For more information, see 3-D Graphics Overview and Walkthrough: Creating and Animating a 3-D Textured Cube in Silverlight.

A user can now search a list of items in an ListBox or ComboBox using keyboard input. You can specify the property that identifies an item for search purposes by setting the TextPath attached property. The list will scroll to the first item that matches.

Dialog Changes

OpenFileDialog and SaveFileDialog have new capabilities. You can use the InitialDirectory property to specify the initial directory when you open the OpenFileDialog. You can use the DefaultFileName property to specify a default file name when you open the SaveFileDialog.

Media

Sound Effects

Silverlight 5 includes new classes for sound effects. You can use the classes in the Microsoft.Xna.Framework.Audio namespace to create and manage sound effects in your applications. Use the SoundEffect class to trigger low-latency sound.

Variable Playback Rate

Silverlight 5 includes the ability to check and change the playback rate of media. MediaElement now includes a PlaybackRate property and a RateChanged event.

Application-Restricted Media

Application-restricted media is a new feature in Silverlight 5 that enables content providers to ensure their content under digital rights management (DRM) is consumed only by Silverlight applications they authorize. This is ensured by requiring Silverlight client applications accessing restricted media to be signed with an Authenticode x.509 certificate. For more information about signing applications, see Application Signing. For more information about DRM, see Digital Rights Management (DRM).

Key Rotation

Silverlight 5 includes support for Live TV scenarios that have policies and licenses. A Silverlight 5 client manages the enforcement of changing policies for the developer. No special client application code is required. For more information, see Digital Rights Management (DRM).

Remote Control Support

Enables users to control media playback. For more information, see MediaCommand.

Graphics

Graphics Stack

The graphics stack has been re-architected to add features such as independent animations.

3-D Graphics

Silverlight 5 introduces the ability to use hardware accelerated 3-D graphics in your Silverlight applications. This opens up a whole new set of scenarios that are possible in Silverlight, such as 3-D drawn controls, data visualizers, 3-D charts, scatter points, geographic overlays, and 3-D games and simulations.

The core of the XNA Games Studio 4.0 graphics libraries is now included in Silverlight 5. These libraries include render targets, XNA built-in effects, and surface composition settings for depth/stencil buffers and multi-sample anti-aliasing. Developers familiar with XNA will be able to quickly get up to speed with Silverlight 3-D graphics programming. For more information, see 3-D Graphics Overview and Walkthrough: Creating and Animating a 3-D Textured Cube in Silverlight.

Text

Character Spacing

Silverlight 5 includes the ability to increase or decrease the amount of space in between characters in text. You can do this by using the CharacterSpacing property available in the Control, TextBlock, and TextElement classes.

Inter-line Spacing

Silverlight 5 enables you to increase or decrease the space between lines of text to increase readability or to change the look and feel of the body of text. You can do this by using the LineHeight and LineStackingStrategy properties available in the Block, TextBlock, TextBox, and RichTextBox.

RichTextBlock and Displaying Overflow Content

Silverlight 5 includes a new RichTextBlock control that you can use to display rich text. You can display the content that does not fit in a RichTextBlock in a RichTextBlockOverflow control. For more information, see RichTextBlockOverflow.

Text Clarity

Silverlight 5 includes more support for OpenType fonts. It also includes support for pixel-snapped text. Both of these features improve text clarity. For more information, see TextFormattingMode.

Trusted Applications

Silverlight 5 includes the following enhancements for trusted applications. For more information, see Trusted Applications.

Access File System

Trusted applications can now access the local file system without restriction.

Multiple Windows

You can display multiple Window instances in trusted, out-of-browser applications. This enables you to create non-modal dialog boxes, tear-off windows, and user-adjustable layouts that can span multiple monitors. For more information, see the Window class.

In-Browser

System administrators can enable trusted applications to run inside the browser, simplifying enterprise deployment and application updates. This also enables you to use some previously out-of-browser-only features inside the browser, including the WebBrowser and NotificationWindow classes. For more information, see How to: Enable Trusted Applications to Run Inside the Browser.

Call Windows APIs

On computers running Windows, you can now call Windows native APIs and unmanaged code from Silverlight 5 applications. This is also referred to as platform invoke or PInvoke. This applies to trusted out-of-browser applications or trusted in-browser applications. For more information, see How to: Call Unmanaged Code from Trusted Applications.

Printing

Silverlight 4 added bitmap printing support. However, all content was rasterized as a bitmap. Silverlight 5 adds vector printing support, which improves printing quality and performance. For more information, see Printing.

User Interface

Detecting Double-Clicks

Silverlight 5 adds a ClickCount event data property to the MouseButtonEventArgs event data class. You can use this property to detect double-clicks, based on platform settings for the time duration that two clicks should be considered a double-click.

Data

Data Binding

Silverlight 5 enables you to debug data bindings by setting breakpoints on bindings in XAML. When a breakpoint is hit, you can use the Locals window to examine the state of a binding and identify any issues. For more information, see Data Binding.

Silverlight 5 also includes several data binding enhancements, some of which were previously available only in Windows Presentation Foundation (WPF). These enhancements enable you to do the following:

  • Use data bindings with styles. To do this, use the Setter.Value property as a binding target. You will typically do this in XAML using the binding markup extension.

  • Bind to ancestors in the visual tree. To do this, set the Binding.RelativeSource property to FindAncestor.

  • Associate bound objects to data templates implicitly by type instead of explicitly by template name. To do this, set the DataTemplate.DataType property for each implicit template instead of specifying x:Key values.

  • Bind to dynamically-generated properties. To do this, implement the ICustomTypeProvider interface on classes with dynamic properties.

  • The FrameworkElement.DataContextChanged event has been added. You can use this event to detect when the data context for an element has changed.

  • The UpdateSourceTrigger.PropertyChanged enumeration value has been added. This indicates to update the binding source whenever the binding target value changes. This can be helpful when the binding target is a TextBox. You can detect changes before the TextBox loses focus. Also, you do not have to handle the TextChanged event, which better supports the MVVM pattern.

XAML

Silverlight 5 now has a IMarkupExtension<T> interface. By implementing the ProvideValue method, you can define a custom markup extension, which can be understood and used by the Silverlight XAML parser. Services that are intended for markup extension service context enable several scenarios that were not possible in Silverlight 4 XAML. For example, it is now possible to implement a similar markup extension behavior to the x:Type markup extension from WPF XAML.

Certain structures that did not support an attribute syntax for setting their properties now support attribute syntax on properties. These structures are: CornerRadius, Thickness, Size, and Rect.

Performance Improvements

You should see performance improvements because of the following changes.

  • Reduced network latency by using a background thread for networking. This is helpful for scenarios that use client HTTP web requests.

  • Improved XAML parser improvements for user controls and resource dictionaries.

  • Support for 64-bit browsers.

  • Increased performance of hardware decoding and presentation of H.264 media for unprotected content.

  • Support for multi-core JIT to improve start-up time for Silverlight applications.