Microsoft launched the Silverlight 4 beta on PDC2009, and Microsoft has handled about 8,000 requests from Silverlight end users in the Silverlight 4 version, adding a series of new features that are exciting for developers, most notably in several ways:
Development tool Enhancements: Visual Studio 2010 has a visual design tool that allows you to choose whether the runtime version is 3.0 or 4.0,blend4 to add XAML and C # code-wide IntelliSense, XAML style applications, and more.
Camera and MIC hardware support: Enables user native webcam and mic with minimal code, and can be recorded locally.
Report Printing support: report printing problems in the SILVERLIGHT4 to get a better solution.
More powerful base class controls (RichTextBox, DataGrid Enhancements): Rich-text control RichTextBox and a DataGrid with the ability to paste and sort is joined.
WCF enhancements: Finally, TCP traffic is supported, compared with HTTP elevation 3-5 times, limited to 4502-4534 ports.
Compatibility enhancements: Support for Google's Chrome browser.
MEF Support: The MEF is all called the Managed Extensibility Framework, translated as the Managed Extensions framework, supporting the creation of large and complex applications.
Running speed: The boot speed and rendering speed are about twice times higher than the previous version.
DRM enhancements: Supports PlayReady, can protect video and audio playback, and complements DRM protection for H.264.
Other enhancements: Local file read/write, right mouse button event support, shear-glue board support.
Before SILVERLIGHT4 we can usually call JavaScript scripts in Silverlight for printing based on ordinary Web pages, but this is not very satisfying either in terms of the way it is printed or in the control of precision.
For a Silverlight, the content that needs to be printed can often be a page of the entire page, or some part of the entire Silverlight application, and if you only use JavaScript pages to print, is unable to meet the requirements for printing in Silverlight applications, but the problem has finally been solved in Silverlight 4.0 in a more perfect way. The System.Windows.Printing namespace is introduced in the Silverlight 4 runtime, which contains a class named PrintDocument that completes a "targeted" print task in a Silverlight application.
Below we use grid to make a simple report.
Xaml:1 < Grid x:name = "LayoutRoot" Background = "White" >
2 < Grid.rowdefinitions >
3 < RowDefinition Height = "*"/>
4 < RowDefinition Height = "+"/>
5 </grid.rowdefinitions >
6 <!--Simple report-->
7 < Border BorderBrush = "BLACK" borderthickness = "1" >
8 < Grid x:name = "Reportgrid" grid. row= "0" showgridlines = "True" >
9 < grid.resources >
< Style TargetType = "TextBlock" >
One < Setter property = "VerticalAlignment" Value = "Center"/>
< Setter property = "HorizontalAlignment" Value = "Center"/ ;
</style >
</grid.resources >
< grid.rowdefinitions >
< RowDefinition Height = "All"/>
< RowDefinition Height = "All"/>
< RowDefinition Height = "All"/>
< RowDefinition Height = "All"/>
< RowDefinition Height = "All"/>
</grid.rowdefinitions >
< grid.columndefinitions >
< ColumnDefinition Width = "M"/>
< ColumnDefinition Width = "/>
< ColumnDefinition Width = "+"/>
Num <