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 enhancesthebuilding 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
Silverlightapplication 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 PrintableAreawill 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 notin 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
相关推荐: