Creating a Movie Viewer for Silverlight 1.0
Our first example application is a movie viewer (Fig. 19.1) that plays Windows Media Video (WMV) videos. This example runs on Silverlight 1.0 Release Candidate, and the user interface was created using Expression Blend 2 August Preview. The XAML was gen-erated primarily by Expression Blend. We discuss the XAML as we show you how to build the user interface.
1. Creating a User Interface In XAML Using Expression Blend
To show how XAML works, we first create elements in Expression Blend, then discuss the corresponding generated XAML in Scene.xaml (which you’ll see in Fig. 19.12).
The root element of the XAML file is a Canvas element. A Canvas element acts as a container for other user interface elements and controls their position. The parent Canvas el-ement is created when you create a new Silverlight project in Expression Blend. The parent Canvas has a default Name of Page, Width of 640 px and Height of 480 px. The Name attribute provides an ID to access the element programmatically. The Canvas’s properties can be edited in the Properties panel (Fig. 19.2). Additional Canvas elements can be cre-ated in Expression Blend using the Canvas tool in the toolbar, shown in Fig. 19.3. The XAML can be manually edited by selecting XAML in Expression Blend’s View menu.
2. Using Storyboards
new keyframe, change any property of the rectangle. If you create the keyframe without changing a property, the Storyboard will not do anything. Close the Storyboard by opening the Open, create or manage Storyboards menu and clicking Close Storyboard.
Expression Blend provides the Gradient brush tool (Fig. 19.7) to visually create and modify gradients. First, use the Selection tool to select the Page Canvas in the design area. Then, select the Gradient brush for the Background and select the gradient slider on the right (Fig. 19.7). Change the red, green and blue values to 71.
Copyright © 2018-2020 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.