What's New in Silverlight 5
-
Upload
mohammad-elsheimy -
Category
Technology
-
view
1.779 -
download
0
Transcript of What's New in Silverlight 5
![Page 1: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/1.jpg)
What’s New in Silverlight 5
Mohammad Elsheimyhttp://JustLikeAMagic.com
http://WithDotNet.nethttp://twitter.com/Elsheimy
![Page 2: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/2.jpg)
Outline
Silverlight 5
XAML Changes
Control and Text Improvements
Graphics and Media Changes
Elevated-Trust Changes
Other Improvements
Get Started
![Page 3: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/3.jpg)
Silverlight 5
Currently in Beta version Has bugs, not yet feature-complete
Some features aren’t available in the Beta
No go-live license
First announced in PDC 2010
Beta released at MIX11
Final release soon this year
![Page 4: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/4.jpg)
Goals
Improving performance
Getting closer to WPF
Enabling line-of-business scenarios
Better development experience
![Page 5: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/5.jpg)
XAML CHANGES
Cairo
at N
ight
, Egy
pt
![Page 6: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/6.jpg)
XAML Changes
Implicit Data Templates
Ancestor RelativeSource
Binding in Styles
Markup Extensions
XAML Debugging
Layout Transitions
![Page 7: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/7.jpg)
Implicit Data Templates
Associated to a data type instead of a specific control
Applies to any control that… trying to display the data type specified
have a templatable content
defined in the scope of the template
Define outside the control (e.g. as a resource) Use DataType to specify the data type
Use binding to communicate with data
Typically used with collection controls (e.g. ListBox, ComboBox, etc.)
![Page 8: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/8.jpg)
DEMO: IMPLICIT DATA TEMPLATES
![Page 9: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/9.jpg)
Ancestor RelativeSource
Allows binding to a property on a parent control
Binding Outside the box
Implements the WPF feature
Use Binding.RelativeSource to specify the source in the tree Use AncestorType to specify parent type
Use AncestorLevel to specify its level in the tree
<TextBlock Text="{Binding Tag, RelativeSource={RelativeSource AncestorType=Grid, AncestorLevel=2}}"/>
![Page 10: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/10.jpg)
DEMO: ANCESTOR RELATIVESOURCE
![Page 11: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/11.jpg)
Binding in Styles
Allows changing styles during runtime
Implements the WPF feature
Binding is supported directly in style setters Use the standard binding syntax
All binding features supported (e.g. converters, formatters, etc.)
<Setter Property="Foreground" Value="{StaticResource theBrush}" />
![Page 12: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/12.jpg)
DEMO: BINDING IN STYLES
![Page 13: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/13.jpg)
Markup Extensions
Create your own markup extensions
Allows you to run custom code at XAML parsing time
Examples of markup extensions: {Binding}, {RelativeSource}, etc.
Much simpler than attached properties
More concise syntax
<TextBlock Text="{my:SumExtension FirstNumber=1, SecondNumber=2}" />
![Page 14: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/14.jpg)
Markup Extensions
Implement IMarkupExtension<T> (System.XAML) Where T is the type of the data that you wish to return (must be reference type)
Provide properties for parameters
Implement ProvideValue() to return the value
public class SumExtension : IMarkupExtension<object>{ public int FirstNumber { get; set; } public int SecondNumber { get; set; }
public object ProvideValue(IServiceProvider serviceProvider) { return FirstNumber + SecondNumber; }}
![Page 15: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/15.jpg)
DEMO: MARKUP EXTENSIONS
![Page 16: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/16.jpg)
XAML Debugging
Allows breakpoints in bindings Works by placing a breakpoint inside the binding in XAML
Stops on Push and Pull to the control
Use VS debugging tools to get binding details
Breakpoint condition and filters can be set
Past approaches: Hunt through the output window for any binding failure information
Create a debug-only value converter, assign it to all bindings, and put the breakpoint
inside it
![Page 17: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/17.jpg)
DEMO: XAML DEBUGGING
![Page 18: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/18.jpg)
Layout Transitions
Create a really rich experience without storyboards or animations just
with a few lines of XAML
Not in Beta
<VisualStateManager.LoadTransition> <LoadTransition StartXOffset="300“ GeneratedDuration="0:0:1.0" StartOpacity="0.2"> <LoadTransition.GeneratedEasingFunction> <CircleEase/> </LoadTransition.GeneratedEasingFunction> </LoadTransition></VisualStateManager.LoadTransition>
![Page 19: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/19.jpg)
CONTROL AND TEXT IMPROVEMENTS
View
from
Cai
ro to
wer
, Cai
ro, E
gypt
![Page 20: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/20.jpg)
Control Improvements
Text Tracking and Leading Control
Text Overflow
Multi-Click Support
Type-Ahead Text Searching
Default Filename in SaveFileDialog
DataContextChanged Event Not in Beta
![Page 21: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/21.jpg)
Text Tracking and Leading
Precisely set how far apart each character is (i.e. character spacing)
Precisely set the height for each line of the content
Available on text controls: TextBlock, TextBox, and RichTextBox
Use CharacterSpacing property to specify distance between characters Measured in 1000th of the font size (e.g. font size = 20px, CharacterSpacing = 500, then
20 * 500 / 1000 = 10px between each character)
Use LineHeight to specify each line’s height in pixels
![Page 22: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/22.jpg)
Line Stacking
Can be set using LineStackingStrategy
Specifies how each line’s box is determined
![Page 23: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/23.jpg)
DEMO: TEXT TRACKING AND LEADING
![Page 24: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/24.jpg)
Text Overflow
Allows for multi-column and free-form text layouts
RichTextBox is required as the master element
Can link one RichTextBoxOverflow to the RichTextBox to capture extra
text which doesn't fit Can continue the chain (i.e. linking another RichTextBoxOverflow to the previous one
and so on)
Use OverflowContentTarget property to specify the next target
<RichTextBox OverflowContentTarget="{Binding ElementName=theOverflow}"/><RichTextBoxOverflow x:Name="theOverflow" />
![Page 25: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/25.jpg)
Multi-Column Text
RichTextBox RichTextBoxOverflow RichTextBoxOverflow
![Page 26: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/26.jpg)
Free-Form Text
RichTextBox RichTextBoxOverflow
RichTextBoxOverflow
RichTextBoxOverflow
RichTextBoxOverflow
![Page 27: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/27.jpg)
DEMO: TEXT OVERFLOW
![Page 28: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/28.jpg)
Multi-Click Support
Allows you to capture n-clicks
Usually used to capture double-clicks (most useful) and triple-clicks
Added ClickCount property to MouseButtonEventArgs
Only valid on MouseLeftButtonDown and MouseRightButtonDown
![Page 29: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/29.jpg)
DEMO: MULTI-CLICK SUPPORT
![Page 30: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/30.jpg)
Type-Ahead Text Searching
Allows you to search for items by typing using keyboard
Works on collection controls (e.g. ComboBox, ListBox, etc.)
Works with implicit data templates
Should specify text to search within using DisplayMemberPath DisplayMemberPath is incompatible with explicit data templates
![Page 31: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/31.jpg)
DEMO: TYPE-AHEAD TEXT SEARCHING
![Page 32: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/32.jpg)
Text Improvements
Better text rendering
Improved performance of text layout
Text clarity is improved with Pixel Snapping
OpenType support has been enhanced
![Page 33: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/33.jpg)
GRAPHICS AND MEDIA CHANGES
Nile
Riv
er, C
airo
, Egy
pt
![Page 34: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/34.jpg)
Graphics Stack Changes
Improved Performance and Rendering
Hardware Acceleration More GPU support
New 3D API
Vector Printing Not in Beta
Print Preview Not in Beta
![Page 35: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/35.jpg)
Improved Performance
Uses Windows Phone 7 composition model Rendering happens on a separated, dedicated thread
Helps with immediate-mode rendering on the GPU
Added support for independent animations
Reduces flickers and “glitchy” animations happen when UI thread was interrupted
![Page 36: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/36.jpg)
3D API
XNA-based 3D stack Not game-loop based
Low-level access to GPU, vertex shaders, and 3D primitives
Can be used for immediate-mode 2D API
New DrawingSurface control to draw within Can do GraphicsDevice-based drawing
Silverlight Control now supports Draw event for custom drawing
Low-level support
Community will likely wrap to simplify use
![Page 37: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/37.jpg)
DEMO: 3D API
![Page 38: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/38.jpg)
Media Changes
Better Battery Management No screensaver in full-screen mode
Remote Control Support Not available in Beta
Hardware decoding; more GPU support H.264 media is now hardware decoded (not in Beta)
In Beta, no DRM or Mac support
1080p Support Combined with GPU, can watch 1080p on a Netbook/Tablet
![Page 39: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/39.jpg)
Media Changes
Speed Control; Trick Play
Low-latency sounds
IIS Media Services 4 Shipped, now supports Windows Azure
![Page 40: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/40.jpg)
Speed Control; Trick Play
Allows you to control play speed in MediaElement
Can slow-down or speed-up media
Can play media forward or backward
Use PlaybackRate to specify play speed (-8, -4, -2, …, 0.5, 1.2, 1.4, 2, 4, 8)
Limitations: No sound; pitch correction not available in Beta
Must set in code, if set in XAML will reset at application start
![Page 41: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/41.jpg)
DEMO: SPEED CONTROL; TRICK PLAY
![Page 42: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/42.jpg)
Low-Latency Sounds
Support for low-latency sounds Raw sounds data (e.g. wave files)
Uses the XNA approach
Can control volume, pitch, and stereo space
Use SoundEffect to load wave files and sound data
Use SoundEffectInstance to play multiple instances of the same audio
Limitations: Same limitations as XNA: 8 or 16bit PCM, mono or stereo, 22.5, 44.1, or 48khz
![Page 43: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/43.jpg)
DEMO: LOW-LATENCY SOUNDS
![Page 44: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/44.jpg)
ELEVATED-TRUST CHANGES
Nile
Riv
er, C
airo
, Egy
pt
![Page 45: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/45.jpg)
Elevated Trust
In-Browser Elevated-Trust Applications
Unrestricted File System Access
Multiple Window Support
Automation and P/Invoke Support Not in Beta
![Page 46: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/46.jpg)
In-Browser Elevated-Trust
Allows running elevated-trust applications in browser No longer need OOB to get elevated-trust features
Keyboard support in full-screen mode, enables for richer kiosk and media viewing apps
All elevated-trust features are available
Must be enabled by Client Access Policy file or Windows Registry Restricted to a private network or a single machine
XAP must be signed with a trusted certificate Certificate must be present in Trusted Publisher Certificate store
For development, “localhost” must be whitelisted
Windows only for Beta
![Page 47: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/47.jpg)
Client Access Policy Approach
Enable by setting ElevatedPermissions attribute in SecuritySettings
element to Required
<Deployment.OutOfBrowserSettings> ... <OutOfBrowserSettings.SecuritySettings> <SecuritySettings ElevatedPermissions="Required" /> <OutOfBrowserSettings.SecuritySettings> ...</Deployment.OutOfBrowserSettings>
![Page 48: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/48.jpg)
Windows Registry Approach
Enable by hooking into registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Silverlight
Set AllowElevatedTrustAppsInBrowser (DWORD) to 0x00000001 to
enable running elevated-trust applications in browser
Use AllowInstallOfElevatedTrustApps to enable/disable installation of
elevated-trust applications completely (in-browser or out-of-browser)
Use AllowLaunchOfElevatedTrustApps to enable/disable elevated-trust
applications completely (in-browser or out-of-browser)
![Page 49: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/49.jpg)
DEMO: IN-BROWSER ELEVATED-TRUST
![Page 50: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/50.jpg)
Multiple Window Support
Allows you to create multiple windows in OOB applications Works on Windows and Mac
Can have custom chrome
Requires elevated trust
Window class is now instantiable Must set location and size
Use Visibility to show the new window
![Page 51: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/51.jpg)
DEMO: MULTIPLE-WINDOW SUPPORT
![Page 52: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/52.jpg)
File System Access
Unrestricted file system access for elevated-trust applications Same rights as the user
Access to complete information
![Page 53: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/53.jpg)
DEMO: FILE SYSTEM ACCESS
![Page 54: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/54.jpg)
OTHER IMPROVEMENTS
Libr
ary
of A
lexa
ndria
, Ale
xand
ria, E
gypt
![Page 55: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/55.jpg)
Performance Improvements
Improved startup performance Multi-core background JIT support
Improved XAML parsing time Specially for UserControls and ResourceDictionaries
64-bit support Not in Beta
Network latency optimizations
90% performance improvements in ClientHttpWebRequest scenarios
Hardware accelerated rendering in Internet Explorer 9 windowless mode Using the new SurfacePresenter API (not in Beta)
![Page 56: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/56.jpg)
Other Improvements
Enabled WS-Trust support in WCF
Windows Azure support
In-browser HTML support
Automated UI testing
Improved profiling support Memory
CPU
Thread contention
Many more fixes and improvements throughout the product
![Page 57: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/57.jpg)
GET STARTED
Nile
Riv
er, A
swan
, Egy
pt
![Page 58: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/58.jpg)
Getting Started
Install Visual Studio 2010 SP1
Visit http://silverlight.net Install the Silverlight 5 Beta Tools for Visual Studio 2010
Optionally, install the Expression Blend Preview for Silverlight 5 Beta
Make cool stuff!
![Page 59: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/59.jpg)
HAVE A QUESTION?
![Page 60: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/60.jpg)
EVALUATION
![Page 61: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/61.jpg)
CONTACT
Mohammad Elsheimy
http://JustLikeAMagic.comhttp://WithDotNet.net
http://twitter.com/elsheimyhttp://facebook.com/justlikeamagic
![Page 62: What's New in Silverlight 5](https://reader033.fdocuments.us/reader033/viewer/2022052900/5561e910d8b42af10c8b4fce/html5/thumbnails/62.jpg)
THANK YOU!