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

Accessing the clipboard


Silverlight 4 introduced a new API for working with text via the clipboard. Currently Silverlight's clipboard API is limited only to text, but it is still a great way for your application to interact with not only its host page, but the entire host OS. Working with the clipboard is all about using the new Clipboard static class. The Clipboard class exposes three methods for working with text as follows:

  • ContainsText: This queries the Clipboard object to check whether or not it includes any text

  • GetText: This retrieves any saved text in the Clipboard object

  • SetText: This sets the text you wish to save in the Clipboard object

Setting and getting text from the clipboard is as trivial as it gets. To get data from the clipboard, we will use the following line of code:

string textFromClipboard = Clipboard.GetText();

To set the clipboard's text, we will use the following line of code:

Clipboard.SetText("Some sample text.");

When trying to use the Clipboard class in a...