Book Image

MCTS: Microsoft Silverlight 4 Development (70-506) Certification Guide

By : Johnny Tordgeman
Book Image

MCTS: Microsoft Silverlight 4 Development (70-506) Certification Guide

By: Johnny Tordgeman

Overview of this book

Microsoft Silverlight is a powerful development platform for creating engaging, interactive applications for many screens across the Web, desktop, and mobile devices. Silverlight is also a great (and growing) Line-Of-Business platform and is increasingly being used to build data-driven business applications. Silverlight is based on familiar .NET languages such as C# which enables existing .NET developers to get started developing rich internet applications almost immediately. "MCTS: Microsoft Silverlight 4 Development (70-506) Certification Guide" will show you how to prepare for and pass the (70-506): TS: Microsoft Silverlight 4 Development exam.Packed with practical examples and Q&As, MCTS: Microsoft Silverlight 4 Development (70-506) Certification Guide starts by showing you how to lay out a user interface, enhance the user interface, implement application logic, work with data and interact with a host platform amongst others.
Table of Contents (15 chapters)
MCTS: Microsoft Silverlight 4 Development (70-506) Certification Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface

Implementing the printing API


You've just created the perfect LOB application. Everything works great and users are happy. After a while, a few of them come to you with a request that seems quite trivial—they need to print forms and pages off your application. As trivial as this request sounds, up until Silverlight 3 this would have been impossible. Silverlight 3 introduced the WriteableBitmap class, which allows you to save any element in your application as a bitmap and then print it. Silverlight 4, however, was the first Silverlight release to introduce a real solution to the printing problem, known as the printing API.

The entire printing process in Silverlight relies on an object called PrintDocument. This object contains three events that cover the entire lifespan of the printing process—BeginPrint, PrintPage, and EndPrint.

The BeginPrint event is raised as soon as the Print method gets called on the PrintDocument object. Then, for each page that needs to be printed, PrintDocument...