Click here to Skip to main content
13,410,032 members (37,000 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

10.8K views
1 bookmarked
Posted 6 Dec 2010

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

, 6 Dec 2010
Rate this:
Please Sign up or sign in to vote.
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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

mbcrump
Software Developer (Senior) Telerik
United States United States
Michael Crump is a Silverlight MVP and MCPD that has been involved with computers in one way or another for as long as he can remember, but started professionally in 2002. After spending years working as a systems administrator/tech support analyst, Michael branched out and started developing internal utilities that automated repetitive tasks and freed up full-time employees. From there, he was offered a job working at McKesson corporation and has been working with some form of .NET and VB/C# since 2003.

He has worked at Fortune 500 companies where he gained experience in embedded systems design and software development to systems administration and database programming, and everything in between.

His primary focus right now is developing healthcare software solutions using Microsoft .NET technologies. He prefers building infrastructure components, reusable shared libraries and helping companies define, develop and automate process standards and guidelines.

You can read his blog at: MichaelCrump.net or follow him on Twitter at @mbcrump.

You may also be interested in...

Pro
Pro

Comments and Discussions

 
-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.180221.1 | Last Updated 6 Dec 2010
Article Copyright 2010 by mbcrump
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid