Skip to main content

Silverlight 2 Bible

Silverlight 2 Bible

ISBN: 978-0-470-44353-8

Nov 2008

512 pages

Select type: E-Book


Product not available for purchase


Create rich, cross-platform, interactive Web applications with Microsoft's new Silverlight and this essential guide. Designers will discover how to add animation, audio, video, and other high-impact effects. Programmers will cover Visual Studio, .NET, and other programming tools—and work with Silverlight's presentation, communications, and data frameworks. Packed with techniques, tips, and a 16-page color insert of striking examples, this is the book you need to succeed with Silverlight—whether you're a designer or programmer.



Part I: Silverlight Basics.

Chapter 1: Getting to Know Silverlight.

What Is Silverlight?

Why Use Silverlight?

Comparing Silverlight 1.0 and 2.

Silverlight Framework Architecture.

The Silverlight plug-in.

The Silverlight core presentation framework.

The .NET Silverlight framework.

Silverlight application architecture.


Chapter 2: Getting Started with Silverlight.

Implementing the Silverlight Development Environment.

Installing Visual Studio 2008.

Installing the Silverlight plug-in.

Installing the Silverlight SDK.

Implementing Silverlight applications on the Linux platform.

Understanding Silverlight Development Tools.

Using Silverlight in Visual Studio 2008.

Designing Silverlight applications and elements in Expression Blend.

Encoding Silverlight media elements in Expression Encoder.

Outputting vector images as XAML using Expression Design.

Encoding Multiscale Images Using Deep Zoom Composer.

Building Your First Silverlight Application.


Part II: Silverlight Design Fundamentals.

Chapter 3: Using XAML to Build Declarative Silverlight Applications.

Understanding the Silverlight/XAML Relationship.

Understanding XML Namespaces.

Creating Silverlight Controls.

Creating a Button.

Creating a Calendar.

Creating a CheckBox.

Creating a DatePicker.

Creating a HyperlinkButton.

Creating an Image.

Creating a ListBox.

Creating a MediaElement.

Creating a RadioButton.

Creating a ScrollBar.

Creating a ScrollViewer.

Creating a Slider.

Creating a TextBlock.

Creating a TextBox.

Creating a ToggleButton.

Designing the Layout of Silverlight Applications.

Using a Canvas control.

Using a Grid control.

Using a TabControl control.

Using a StackPanel control.

Using a Border control.

Using XAML Transforms.







Creating a Rectangle.

Creating an Ellipse.

Creating a Path.

Using XAML Brushes.

Adding a SolidColorBrush.

Adding a LinearGradientBrush.

Adding a RadialGradientBrush.

Adding an ImageBrush.

Adding a VideoBrush.

Implementing Animations and Storyboards.

Defining Storyboard controls.

Starting animations upon page load.

Creating From/To animations.

Creating Key Frame animations.

Creating animations as Resources.

Attaching Event Handlers to XAML Elements.


Chapter 4: Using Expression Blend to Design Silverlight Applications.

Getting Started with Expression Blend.

Creating a Silverlight application project in Expression Blend.

Using the Design, XAML, and Split views.

Understanding the Expression Blend Toolbox.

Adding Silverlight controls.

Arranging Controls in the Design View.

Using snaplines and gridlines.

Aligning controls.

Nesting controls using layout panels.

Ordering controls.

Modifying the Properties of Silverlight Controls.

Naming the control.

Attaching event handlers to controls.

Applying brushes to controls.

Setting appearance properties of controls.

Setting the layout of controls in the Silverlight application.

Applying transforms to controls.

Modifying other control properties.

Creating Storyboards and Animations in Expression Blend.

Creating a Storyboard.

Animating Silverlight controls in a Storyboard timeline.

Playing animations in Expression Blend.

Recording and modifying key frames.

Importing Vector Images Using Expression Design and Expression Blend.

Exporting XAML from Expression Design.

Adding exported XAML to a Silverlight application.


Chapter 5: Encoding Audio, Video, and Images for Silverlight Applications.

Configuring Video in a Job.

Importing audio and video into Expression Encoder.

Using the timeline controls to cut audio or video.

Configuring Audio and Video Encode Settings.

Configuring an encoded media file profile.

Configuring a video profile for display in Silverlight.

Setting audio and video preprocessing options.

Encoding Metadata in the Media File.

Adding metadata.

Adding timeline markers to video.

Adding script commands to a video file.

Configuring Silverlight Output.

Generating a thumbnail.

Specifying a template.

Modifying the template in Expression Blend.

Specifying output options.

Implementing Encoded Media in Silverlight Applications.

Understanding encoded output.

Using the encoded output in a Silverlight application.

Encoding Multiscale Images Using Deep Zoom Composer.

Importing Images into Deep Zoom Composer.

Arranging Images in Deep Zoom Composer.

Exporting Multiscale Images from Deep Zoom Composer.

Understanding the Exported Multiscale Image Project.


Part III: Programming Silverlight Applications.

Chapter 6: Using Visual Studio to Program Silverlight Applications.

Developing a .NET Silverlight Application in Visual Studio.

Creating a Silverlight project.

Adding Silverlight controls.

Naming Silverlight controls.

Adding event handlers to Silverlight controls.

Testing Silverlight applications in Visual Studio.

Using IntelliSense.

Using the Solution Explorer.

Switching to Expression Blend.

Adding resources.

Build settings.


Chapter 7: Creating .NET Silverlight Applications.

Understanding the Anatomy of a .NET Silverlight Application.

Application assembly package.

Implementing library assemblies.

Using resource files.

Implementing the Application Class.

Application class methods.

Displaying the application UI.

Using initialization parameters.

Deploying .NET Silverlight Applications in Web Pages.

Embedding a Silverlight plug-in in an HTML Web page.

Embedding a Silverlight application using the asp:Silverlight tag.


Chapter 8: Programming .NET Silverlight Applications.

Manipulating XAML Elements Programmatically.

Accessing namescoped XAML elements.

Modifying existing Silverlight XAML elements.

Dynamically adding/removing XAML elements.

Implementing Event Handling.

Application events.

Silverlight control events.

Mouse events.

Keyboard events.

Media events.

Other control events.

Controlling Animations Programmatically.

Starting and stopping the animation.

Handling the animation completed event.

Dynamically creating animations in code.

Implementing Multiscale Images in Silverlight Applications.


Chapter 9: Programming Silverlight Applications with JavaScript.

Understanding the Silverlight–JavaScript Relationship.

Managed JavaScript versus unmanaged JavaScript.

Using the Silverlight.js library.

Creating and Embedding the Silverlight Application.

Configuring parameters of the createObject and createObjectEx functions.

Creating the Silverlight object in a separate JavaScript file.

Accessing XAML Using Unmanaged JavaScript.

Accessing the Silverlight object.

Accessing the Silverlight application settings.

Accessing XAML content.

Implementing Event Handling in Unmanaged JavaScript.

Dynamically Loading Content in Unmanaged JavaScript.

Understanding the Downloader object.

Dynamically loading XAML.

Dynamically loading text and media.


Chapter 10: Programming Silverlight Applications with ASP.NET Services and AJAX.

Creating an ASP.NET Web Service to Use Silverlight.

Creating an ASP.NET Web application.

Registering the Silverlight assembly.

Adding a ScriptManager.

Embedding an asp:Silverlight tag in an ASP.NET Web page.

Creating a Web service.

Adding Web methods to the ASP.NET Web service.

Creating a Silverlight Application for ASP.NET Web Services.

Linking a Silverlight application to an ASP.NET Web application.

Adding a service reference to the Silverlight application.

Accessing an ASP.NET Web service from Silverlight.

Using asp:MediaPlayer AJAX Element to Directly Embed Video.

Registering the Silverlight assembly.

Adding a ScriptManager.

Embedding an asp:MediaPlayer tag in an ASP.NET Web page.

Adding MediaChapters controls.

Encoding video for AJAX scripting.

Adding an AJAX-enabled WCF service.

Implementing marker events in AJAX.


Chapter 11: Programming Silverlight Applications Using the Dynamic Language Runtime.

Configuring a Silverlight DLR Application.

Embedding a Silverlight DLR application in a Web page.

Building the AppManifest.xml file.

Using Chiron.

Using Chiron as a Web server to test applications.

Creating an XAP file.

DLR Console on the Web.

Creating an IronPython Silverlight Application.

Creating XAML for the IronPython Silverlight application.

Creating a manifest for the IronPython Silverlight application.

Providing access to CLR libraries and namespaces in Python.

Accessing XAML from IronPython.

Implementing event handling in IronPython.

Adding dynamic XAML using IronPython.

Example of an IronPython Silverlight application.

Creating an IronRuby Silverlight Application.

Creating XAML for the IronRuby Silverlight application.

Creating a manifest for the IronRuby Silverlight application.

Providing access to CLR libraries and namespaces in IronRuby.

Accessing XAML from IronRuby.

Implementing event handling in IronRuby.

Adding dynamic XAML using IronRuby.

Example of an IronRuby Silverlight application.

Creating a Managed JavaScript Silverlight Application.

Creating XAML for the managed JavaScript Silverlight application.

Creating a manifest for the managed JavaScript Silverlight application.

Providing access to CLR libraries and namespaces in managed JavaScript.

Accessing XAML from managed JavaScript.

Implementing event handling in managed JavaScript.

Adding dynamic XAML using managed JavaScript.

Example of a managed JavaScript Silverlight application.


Chapter 12: Programming Custom Silverlight Controls and Libraries.

Creating Custom Silverlight Controls in Applications.

Creating a custom User Control in a Visual Studio project.

Creating the custom control UI.

Coding the functionality.

Implementing the custom control in the project.

Example of implementing a custom Silverlight User Control.

Creating Silverlight Class Library Controls.

Creating the Silverlight library.

Defining the UI for the custom control.

Implementing the custom control functionality.

Example of a custom control Silverlight class library.

Adding a Silverlight Class Library Control to an Application.


Part IV: Understanding Silverlight Frameworks.

Chapter 13: Using the Silverlight Presentation Framework.

Understanding the Silverlight Presentation Framework.

Interacting with the HTML DOM.

Accessing the HTML DOM from managed code.

Accessing managed code from HTML JavaScript.

Accessing the Local File System from Silverlight Applications.

Using the operating system’s native open for read-only.

Accessing the isolated local storage.

Implementing Threading in Silverlight Applications.

Implementing a timer thread.

Adding background threads to Silverlight applications.


Chapter 14: Using the Silverlight Communication Framework.

Enabling Network Security Access for Silverlight Applications.

Using a WebClient to Download Resources on Demand.

Using a WebClient to download a text file.

Using a WebClient to download and access a ZIP package.

Accessing RSS Services.

Implementing Sockets in Silverlight Applications.

Opening a socket to a remote host.

Sending data on a socket.

Receiving data from a socket.

Closing a socket.

Example of a Silverlight socket application.

Using the HttpWebRequest and HttpWebResponse Objects.

Using the HttpWebRequest to send requests.

Using the HttpWebResponse class to handle responses.

Example of using HttpWebRequest and HttpWebResponse to send POST data.


Chapter 15: Using the Silverlight Data Framework.

Using XmlReader and XmlWriter.

Implementing XmlReader to parse XML data.

Implementing XmlWriter to write XML data.

Example: Reading and writing XML data in memory.

Serializing a Data Object into XML.

Serializing objects into XML.

Deserializing objects from serialized XML.

Example: Serializing and deserializing XML data in isolated storage.

Implementing Data Binding in Silverlight Applications.

Implementing a DataGrid Control.

Using LINQ in Silverlight to Query SQL Databases.

Creating a Web server Silverlight application project that accesses SQL using LINQ.

Setting up the Silverlight project to use the LINQ service.


Part V: Appendixes.

Appendix A: Silverlight Resources.

Appendix B: Silverlight Control Reference.