DOCX

What's New in Silverlight 4 Whitepaper

By Katherine Stevens,2014-06-23 11:38
14 views 0
What's New in Silverlight 4 Whitepaper

Silverlight 4 Overview

Silverlight 4 Overview

    Technical Features

April 15, 2010

    John Papa jopapa@microsoft.com

    Adam Kinney adkinn@microsoft.com

    1 | Page

Silverlight 4 Overview

    Contents

    Credits .................................................................................................................................................... 6

    Introduction ........................................................................................................................................... 7

    Enabling Business Application Development ...................................................................................... 8 Printing ........................................................................................................................................... 8

    Localization with Bi-Directional and Script-Based Text and Right-to-Left Support.................. 9

    Extended Language Support ........................................................................................................ 9 RichTextBox Control ...................................................................................................................... 9 Text Input ..................................................................................................................................... 11

    Viewbox Control .......................................................................................................................... 12 Auto-Sizing Columns and Copy from DataGrid ........................................................................ 13

    Navigation Page Loading Extensibility ....................................................................................... 13 Command Property on ButtonBase and Hyperlink ................................................................... 14

    SelectedValue and SelectedValuePath on the Selector ............................................................ 14

    Support for Referer Header ........................................................................................................ 16 UDP Multicast Client Support ..................................................................................................... 16 Networking Enhancements ......................................................................................................... 16 WCF TCP-based Binding ............................................................................................................. 17 WCF PollingDuplex Improvements ............................................................................................ 17 Authentication Support with ClientHttpWebRequest ............................................................... 17

    IDataErrorInfo .............................................................................................................................. 18

    INotifyDataErrorInfo .................................................................................................................... 21 Grouping on CollectionViewSource ........................................................................................... 21 Editable CollectionView IEditableCollectionView ...................................................................... 22

    Binding to String Indexers .......................................................................................................... 22 TargetNullValue ........................................................................................................................... 23

    StringFormat ................................................................................................................................ 23

    FallbackValue ............................................................................................................................... 23

    Databinding Support for Dependency Objects ......................................................................... 24

    2 | Page

Silverlight 4 Overview

    XPath Support for XML ............................................................................................................... 25 ObservableCollection<T> Constructor Accepts IList and IEnumerable ................................... 25

    Isolated Storage Enhancements ................................................................................................. 25 Managed Extensibility Framework (MEF) ................................................................................... 25 SDK Enhancements ..................................................................................................................... 27 Silverlight Toolkit ................................................................................................................................ 27

    BusyIndicator ............................................................................................................................... 27

    ContextMenu ............................................................................................................................... 29

    Microsoft Silverlight 4 Tools for Visual Studio 2010 ......................................................................... 30

    WCF RIA Services Support .......................................................................................................... 30 Automatic Layout ........................................................................................................................ 31 Enhanced Property Editing ......................................................................................................... 32 Styling and Resources ................................................................................................................. 33 WCF RIA Services ................................................................................................................................ 35

    Overview of WCF RIA Services in Silverlight 4 ........................................................................... 35

    Key Problems Solved ................................................................................................................... 35 Key Classes: DomainService and DomainContext ..................................................................... 35

    DomainService Operations ......................................................................................................... 36 Endpoints ..................................................................................................................................... 36

    DomainContext Generation ........................................................................................................ 37 Authentication and Authorization .............................................................................................. 37 Validation and MetaData ............................................................................................................ 37 DomainDataSource ..................................................................................................................... 37 WCF RIA Services Toolkit ............................................................................................................ 38 Performance and Reliability ........................................................................................................ 38 Notes ............................................................................................................................................ 38

    Empowering Richer Experiences ........................................................................................................ 39 Hardware Accelerated PlaneProjection ...................................................................................... 39 Word Based Text Trimming (trailing ellipses) ............................................................................ 39

    3 | Page

    Silverlight 4 Overview

    Implicit Styles ............................................................................................................................... 39

    MouseWheel Support ................................................................................................................. 40 Right Mouse Click........................................................................................................................ 40 Programmatic Clipboard Access ................................................................................................ 42 Silverlight as a Drop Target ........................................................................................................ 43 Handle Drag-and-Drop Events for Macintosh .......................................................................... 44

    Webcam and Microphone Support............................................................................................ 44 Webcam and Microphone Permissions ..................................................................................... 47 CompositeTransform................................................................................................................... 48 Support for all PNG Formats ...................................................................................................... 49 Offline Digital Rights Management............................................................................................ 49 MP4 Playback Protected DRM .................................................................................................... 49 WMS Multicast ............................................................................................................................ 50

    Output Protection ....................................................................................................................... 50 Parser Enhancements .................................................................................................................. 50 Deep Zoom .................................................................................................................................. 51

    Google Chrome Support ............................................................................................................. 51 Private Mode Browsing ............................................................................................................... 51 Pinned Full-Screen Mode on Secondary Display ...................................................................... 51

    Media Updates ............................................................................................................................ 51

    Key Expression Blend Features ........................................................................................................... 53 Interoperability with Visual Studio 2010 .................................................................................... 53 PathListBox Control ..................................................................................................................... 53 Transition Effects ......................................................................................................................... 54 Conditional Behaviors ................................................................................................................. 55 Bindable Properties ..................................................................................................................... 55 New Behaviors ............................................................................................................................. 56

    MVVM Project and Item Templates ........................................................................................... 58 Design-time data from CLR types .............................................................................................. 58

    4 | Page

    Silverlight 4 Overview

    Design-time ViewModels ............................................................................................................ 58

    Moving Beyond the Browser Sandboxed Applications ................................................................. 60

    Out-of-Browser Windowing Updates ........................................................................................ 60 Hosting Web Content within Silverlight Applications ............................................................... 60

    WebBrowserBrush ....................................................................................................................... 61 Notifications (Toast) .................................................................................................................... 62 Window Closing Event ................................................................................................................ 63

    Moving Beyond the Browser Elevated Trust Applications ............................................................. 65

    Native Integration ....................................................................................................................... 66 File System Access ....................................................................................................................... 66 Cross-Domain Networking Access ............................................................................................. 67 Full File Path on Open and Save Dialogs ................................................................................... 67 Sockets Security ........................................................................................................................... 68

    XAP Signing ................................................................................................................................. 68

    Silent Install with SLLauncher.exe ............................................................................................... 71 Custom Window Chrome............................................................................................................ 71 Full Keyboard in Full Screen Mode............................................................................................. 72

    Silverlight 4 Resources ........................................................................................................................ 74 Tools ............................................................................................................................................. 74

    Training Kit ................................................................................................................................... 74

    Screencasts .................................................................................................................................. 74

    Blogs ............................................................................................................................................. 74

    Twitter .......................................................................................................................................... 75

    Key Links ...................................................................................................................................... 75

    5 | Page

Silverlight 4 Overview

    Credits

    This document was written in collaboration with many people including most of the Microsoft Silverlight product team, the WCF RIA Services team, and the Expression Blend team. Their help in providing resources, content, and feedback was invaluable.

    Special thanks to Adam Kinney who authored the Expression Blend content, which is a selected excerpt from the full Expression Blend Technical Whitepaper found at this link http://go.microsoft.com/fwlink/?linkid=186042.

    If you have any feedback on this document, contact:

    ; John Papa - jopapa@microsoft.com

    ; Adam Kinney - adkinn@microsoft.com

    6 | Page

Silverlight 4 Overview

    Introduction

    Silverlight 4 enhances the building of business applications, media applications, and applications that reach beyond the browser. New features include printing support, significant enhancements for using forms over data, support for several new languages, full support in the Google Chrome web browser, WCF RIA Services, modular development with MEF, full support in Visual Studio 2010, bi-directional text, web camera and microphone support, rich text editing, improved data binding features, HTML support, MVVM and commanding support, new capabilities for local desktop integration running in the new “Trusted Application” mode such as COM automation and local file access.

    This document explains the new features in Silverlight, where you can find learning materials, and identifies additional resources.

Figure 1

    Silverlight 4 Multi Touch Puzzle Using the New Trusted Application, WebBrowser Control, and WebBrowserBrush Features

    7 | Page

Silverlight 4 Overview

    Enabling Business Application

    Development

Printing

    Silverlight adds printing support that allows developers to control whether their Silverlight application can print itself, how the content is formatted when printed, and determine the content that will appear. For example, you could add a print button to your Silverlight application that opens the Print dialog allows the user to choose the printer, and then prints the Silverlight content.

    You can print content by first creating an instance of the PrintDocument class, then specifying the content to print, and finally writing code to handle the PrintPage event. You can print the entire Silverlight control by setting PrintPageEventArgs.PageVisual to the layout root of the Silverlight content. Alternatively, you can print a portion of the Silverlight content by setting PrintPageEventArgs.PageVisual to the named UIElement you wish to print. The following code sample prints all content within the UIElement named in the Silverlight application. C#

    PrintDocument pd = new PrintDocument();

    pd.PrintPage += (s, args) =>

     {

     args.PageVisual = LayoutRoot;

     };

    pd.Print();

    After the PrintPage event occurs, the content from the PageVisual is sent to the selected printer to be printed. Content that is too large to fit in to the PrintableArea will be clipped. If HasMorePages is true, PrintPage occurs multiple times until HasMorePages is false. If you require customized printing options, you can write code for the StartPrint and EndPrint events to perform special handling.

    You can print content that is not in the live visual tree. This allows you to make your printed

    content look different from your onscreen content. To do this, set PageVisual to a UIElement created in the PrintPage event without adding it to the live visual tree. Another tip to print elements which are not in the live tree is to explicitly run layout on them by calling measure and arrange.

    8 | Page

Silverlight 4 Overview

    Localization with Bi-Directional and Script-Based Text and Right-to-Left Support Silverlight introduces support for shaped and script languages that flow right to left, such as Arabic and Hebrew. The ability to change the direction of the flow is available to all Silverlight UI elements by setting the FlowDirection property to LeftToRight or RightToLeft. The default bi-directional (Bi-Di) FlowDirection property is from LeftToRight. Setting FlowDirection to RightToLeft on any element sets the alignment to the right, the reading order to right-to-left, and the layout of the control to flow from the right to the left. Most UIElement controls inherit the FlowDirection from their parent; however Image, MediaElement, MultiScaleImage, and Popup do not and remain LeftToRight unless overridden explicitly. When brushes and effects are applied to elements whose FlowDirection property is set RightToLeft, the result is flipped horizontally.

Extended Language Support

    Silverlight 4 now supports several new languages including Thai and Vietnamese as well as multiple Indic scripts both for rendering and input. The following Indic scripts are now supported:

    Script Languages

    Bengali Bengali, Assamese, Manipuri

    Oriya Oriya

    Malayalam Malayalam

    Kannada Kannada

    Tamil Tamil

    Telugu Telugu

    Gujarati Gujarati

    Gurmukhi Punjabi

    Devanagari Hindi, Marathi, Sanskrit, Konkani, Kashmiri, Nepali, Sindhi

RichTextBox Control

    Silverlight adds the new RichTextBox control to the standard controls offered by Silverlight. Through the FlowDirection property, the RichTextBox has Bi-Directional (Bi-Di) support on content including Runs. It also allows hyperlinks, XAML content, embedding of images, changing the font size, foreground color, and making text bold, italicized, and underlined as well as many other rich text features.

    The RichTextBox supports the “format then type” feature. For example, with this feature you can choose a format, such as bold or font color of green, and when you start typing the formatting

    9 | Page

Silverlight 4 Overview

    selections you made are applied to the text you type. Text position and selection APIs are also supported.

    Another feature of the RichTextBox control is paragraph blocks, which allows different formatting of blocks of text. Built-in keyboard commands can be used to allow shortcuts for clipboard and undo operations. The RichTextBox also supports mouse events, XAML to clipboard features, undo, and language localization.

    The following image shows the RichTextBox control using the FlowDirection = RightToLeft and displaying Hebrew text.

Figure 2

    RichTextBox with FlowDirection of RightToLeft

    The following image shows a sample application with a RichTextBox control containing several different types of content, including embedded images, an embedded Silverlight DataGrid, different font sizes, different fonts, foreground colors, bold, and italics.

    10 | Page

Report this document

For any questions or suggestions please email
cust-service@docsford.com