Overview

Several new features were introduced in Silverlight 4 that can be used to create rich media applications. In addition to media enhancements, Silverlight 4 now supports implicit styles. This means that controls will implicitly pick up the style via the TargetType without having to explicitly specify the Style key resource or rely on the implicit style manager. Silverlight 4 provides the highly anticipated functionality of being able to securely interact with client machine hardware devices via the browser plug-in. This includes capturing information such as audio / video streams from webcams and microphones and spooling output into a printer device.

This lab demonstrates how to use rich media features of Silverlight 4 to effectively use implicit styles, create visual effects and use a webcam. The solution consists of 2 projects, a Silverlight 4 project and an ASP.NET server host application. During this lab we will be modifying the Silverlight project only.

In exercise 1 we will apply implicit styles, a new feature in Silverlight 4 which allows a style to be applied to all elements of matching type. Following this, we will apply various pixel shader effects to an image, animating various properties of these effects. Finally we will apply a perspective transform to the canvas and animate it to yield a 3D planar effect.

During exercise 2, we will add webcam capture functionality. This involves retrieving the default visual input devices of the host environment, checking if the devices can be initialized correctly, instantiating the CaptureSource, hook up to devices, starting and stopping capture, and setting a VideoBrushSource to the CaptureSource. Next, we will asynchronously capture an image from the video stream. Finally, we will open a ChildWindow dialog and display a still of the animation and the pixel shader effects. We will implement Print functionality to print this captured still to a print device via the Silverlight plugin.

Estimated completion time for this lab is 60 minutes.