Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Silverlight 5 What's New? (Including Screenshots & Code Snippets)

0.00/5 (No votes)
6 Dec 2010 1  
What's new in Silverlight 5

image

Silverlight 5 is coming next year (2011) and this blog post will tell you what you need to know before the beta ships. First, let me address people saying that it is dead after PDC 2010. I believe that it’s best to see what the market is doing, not the vendor. Below is a list of companies that are developing Silverlight 4 applications shown during the Silverlight Firestarter. Some of the companies have shipped and some haven’t. It’s just great to see the actual company names that are working on Silverlight instead of “people are developing for Silverlight”.

image

The next thing that I wanted to point out was that HTML5, WPF and Silverlight can co-exist. In case you missed Scott Gutherie’s keynote, they actually had a slide with all three stacked together. This shows Microsoft will be heavily investing in each technology. Even I, a Silverlight developer, am reading Pro HTML5.

image

Microsoft said that according to the Silverlight Feature Voting site, 21k votes were entered. Microsoft has implemented about 70% of these votes in Silverlight 5. That is an amazing number, and I am crossing my fingers that Microsoft bundles Silverlight with Windows 8.

Let’s get started… what’s new in Silverlight 5? I am going to show you some great application and actual code shown during the Firestarter event.

Media

image

  • Hardware Video Decode – Instead of using CPU to decode, we will offload it to GPU. This will allow netbooks, etc. to play videos.
  • Trickplay – Variable Speed Playback – Pitch Correction (If you speed up someone talking, they won’t sound like a chipmunk).
  • Power Management – Less battery when playing video. Screensavers will no longer kick in if watching a video. If you pause a video, then screensaver will kick in.
  • Remote Control Support – This will allow users to control playback functions like Pause, Rewind and Fastforward.
  • IIS Media Services 4 has shipped and now supports Azure.

Data Binding

image

Layout Transitions – Just with a few lines of XAML, you can create a really rich experience that is not using Storyboards or animations.

<VisualStateManager.LoadTransition>
    <LoadTransition StartXOffset="300" GeneratedDuration="0:0:1.0" StartOpacity="0.2">
       <LoadTransition.GeneratedEasingFunction>
        <CircleEase/>
        </LoadTransition.GeneratedEasingFunction>
    </LoadTransition>
</VisualStateManager.LoadTransition>

RelativeSource FindAncestor – Ancestor RelativeSource bindings make it much easier for a DataTemplate to bind to a property on a container control.

<ComboBox ItemTemplate={StaticResource BookItemTemplate} 

ItemsSource="{Binding DataContext.Book, 
RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}"/>

Custom Markup Extensions – Markup extensions allow code to be run at XAML parse time for both properties and event handlers. This is great for MVVM support.

<ListBox SelectionChanged="{MyTestMethodBinding:Invoke Method=OnSelectCategory}"/>

Changing Styles during Runtime By Binding in Style Setters – Changing Styles at runtime used to be a real pain in Silverlight 4, now it’s much easier. Binding in style setters allows bindings to reference other properties.

<Style x:Key="AccentBlocks" TargetType="Rectangle">
   <Setter Property="Fill" Value="{Binding MyBrush, Source={StaticResource MyColorSettings}"/>
</Style>

XAML Debugging – Below you can see that we set a breakpoint in XAML. This shows us exactly what is going on with our binding.

image

WCF & RIA Services

image

  • WS-Trust Support – Taken from Wikipedia: WS-Trust is a WS-* specification and OASIS standard that provides extensions to WS-Security, specifically dealing with the issuing, renewing, and validating of security tokens, as well as with ways to establish, assess the presence of, and broker trust relationships between participants in a secure message exchange.
  • You can reduce network latency by using a background thread for networking.
  • Supports Azure now.

Text and Printing

image

  • Improved text clarity that enables better text rendering.
  • Multi-column text flow, Character tracking and leading support, and full OpenType font support.
  • Includes a new Postscript Vector Printing API that provides control over what you print.
  • Pivot functionality baked into Silverlight 5 SDK.

Graphics

image

  • Immediate mode graphics support that will enable you to use the GPU and 3D graphics supports.

Take a look at what was shown in the demos below.

1) 3D view of the Earth – not really a real-world application though.

image

A doctor’s portal. This demo really stood out for me as it shows what we can do with the 3D / GPU support.

image

image

Out of Browser

image

  • OOB applications can now create and manage childwindows as shown in the screenshot below.
  • Trusted OOB applications can use P/Invoke to call Win32 APIs and unmanaged libraries.
  • Enterprise Group Policy Support allow enterprises to lock down or up the sandbox capabilities of Silverlight 5 applications.

In this demo, he tore the “notes” off of the application and it appeared in a new window. See the black arrow below.

image

In this demo, he connected a USB Device which fired off a local Win32 application that provided the data off the USB stick to Silverlight.

image

Another demo of a Silverlight 5 application exporting data right into Excel running inside of browser.

image

Testing

image

  • They demoed Coded UI, which is available now in the Visual Studio Feature Pack 2. This will allow you to create automated testing without writing any code manually.

Performance

image

  • Microsoft has worked to improve the Silverlight startup time.
  • Silverlight 5 provides 64-bit browser support.
  • Silverlight 5 also provides IE9 Hardware acceleration.

I am looking forward to Silverlight 5 and I hope you are too. Thanks for reading and I hope you visit again soon.

alt Subscribe to my feed

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here