Designing Windows Applications with Expression Blend - Manual To download the course materials, including lab manuals and assets, visit: http://web.entirenet.net/expressionblend/
Expression Design End-To-End Exercise:
Page 1
Expression Blend End-To-End Exercise:
Page 71
The School Of Fine Art:
Page 201
Fabrikam Ordering Application:
Page 259
About the Training: In this course students will work with the following tools and technologies: •
Expression Blend
•
Expression Design
•
NET Framework 3.0, Windows Presentation Foundation, XAML
•
Visual Studio 2005
Students will cover topics such a designing the user interface for a video player and then converting that into an actual fully functioning video player by defining dynamic layout, creating custom controls, incorporating video, binding controls to work with each other, binding to external XML data to create an interactive video catalog and more. Designers will also experience other real world scenarios where they will discover the huge potential that Expression Blend enables them to have to dramatically increase the experience of a Windows application.
Expression Design End-to-End Exercise Contents Contents..................................................................................................................1 Background.............................................................................................................1 Exercise 1 – End-To-End Exercise............................................................................2 Exercise 1 – End-To-End Exercise
Background We’ve been commissioned by Fabrikam to develop a new media player. Working within their style guidelines and wireframes, we have the next 90 minutes to design something visually compelling. This manual is intended as a guide for designing the user interface and does not delve into the same level of detail that you would normally use when designing a production application. During the course of this lab, you may find it useful to zoom in and out when dealing with finely-tuned pixel locations, as well as element heights and widths. However, strict adherence to exact locations and dimensions is not critical, so please don’t worry too much about matching the screenshots exactly.
2
Exercise 1 – End-To-End Exercise Steps
Screenshots
1. Select Start | All Programs, Microsoft Expression | Microsoft Expression Design. 2. From the File menu, select New.... 3. In the New Document dialog, make the following changes: ○
Name to VideoPlay er_UI
○
Resolution to 72 px/inch
○
Width to 850
○
Height to 580
4. Click OK to create the new document.
3
5. From the main menu, ensure that View | Show | Guides is checked. 6. From the main menu, ensure that View | Snap To Guides is checked. 7. Click on the left ruler and drag a vertical guide onto the artboard at the 0 coordinate, which is the left edge of the canvas. 8. Repeat the last step by dragging vertical guides at 515 and 850. 9. Drag horizontal guides at 0, 35, 495, and 580.
4
10.Click on the Rectangle button in the Toolbox to activate the Rectangle tool.
11.Draw a rectangle inside the top two horizontal guides to serve as our title bar.
12.Using the Appearance panel, change the Fill to a dark grey.
5
13.Draw two more rectangles on the canvas for the left and right sides, respectively. The whole canvas should be a solid grey now. Ignore the horizontal guide at 495 for now.
14.Press V to activate the Selection tool. 15.Select the top title bar rectangle by clicking on it.
16.Using the Appearance panel, change the Fill to a gradient brush.
6
17.Select the first gradient stop and use a bright yellow.
18.Select the second gradient stop and select a slightly darker yellow.
7
19.In the Toolbox, click and hold the Fill Transform button to access its alternative tools menu. Select the Gradient Transform tool.
20.Drag a line from top to bottom on the title bar rectangle to have the gradient move downward. 21.The title bar should now look similar to this screenshot.
8
22.Click on the left body rectangle to select it. This area will host the currently playing video, its information, and actions for it.
23.From the Appearance panel, change the Fill to use a gradient brush.
9
24.Select the first gradient stop and change the color to black.
25.Select the second gradient stop and change its color to a dark blue.
10
26.Click on the Gradient Transform button in the Toolbox to activate the Gradient Transform tool.
27.Drag the gradient transform from the bottom to the top of the rectangle to adjust the gradient to this path.
11
28.The canvas should now look similar to this screenshot.
29.Select the right body rectangle on the canvas. This area will host queued video information.
12
30.From the Appearance panel, change the Fill to use a gradient brush.
31.Select the first gradient stop and change the color to a bright yellow.
13
32.Select the second gradient stop and change the color to a darker yellow.
33.Click on the Gradient Transform button in the Toolbox to activate the Gradient Transform tool.
14
34.Drag the gradient transform from the top of the rectangle to the bottom to change the gradient path.
35.The canvas should now look similar to this screenshot.
15
36.Click on the Rectangle button in the Toolbox to activate the Rectangle tool.
37.Draw a rectangle across the entire canvas directly under the title bar. Its fill will likely look very similar to the title bar, so they may be hard to distinguish. In this screenshot, the rectangle directly below the lower guide is the one to draw.
16
38.At the bottom of the Expression Design window, click on the Unlink width and height sliders toggle. This will allow you to edit the height or width of the selected element using the sliders around it without constraining the shape’s proportions. 39.Make sure the Width is 850 and the Height is 80.
40.The top, left, and right edges of the rectangle should snap to their respective guides. You may want to zoom in using the Zoom tool (Z) to verify this. 41.From the Appearance panel, change the Fill to black.
17
42.Also in the Appearance panel, change the Opacity to 50.
43.The canvas should now look similar to this screenshot.
44.Click on the Rectangle button in the Toolbox to activate the Rectangle tool.
18
45.Draw a rectangle over the left body rectangle that uses the lower guide as its top edge. Its left and right edges should snap to the guides used by the left body rectangle. The rectangle should be 25 pixels high. 46.From the Appearance panel, change the Fill to white and the Opacity to 30.
19
47.Draw a rectangle from the bottom of the title bar to the bottom of the canvas, directly to the right of the center guide. It should snap to the guides on its top, left, and right. The rectangle should be 6 pixels wide. This rectangle will represent a grid splitter that allows the user to reallocate space between the right and left sides at runtime.
48.Press Z to activate the Zoom tool. Make a small window around the top edge of the newly draw rectangle to zoom to it. 49.At the bottom of Expression Design, ensure the width is 6 pixels.
20
50.Use the mouse or arrow keys to nudge the rectangle up against the top guide (which is the bottom guide of the title bar). 51.Nudge the rectangle sideways so that it is centered on the middle guide, with 3 pixels on each side.
52.From the Appearance panel, change the Fill to white and set the Opacity to 100.
21
53.The canvas should now look similar to this screenshot.
54.Click Z to activate the Zoom tool. Draw a small window around the center of the grid splitter rectangle to zoom in on it.
22
55.In the Toolbox, click and hold the Rectangle button to access its alternative tools menu. Select the Ellipse tool.
56.Hold the Shift key and draw a circle (the Shift key ensures equal proportions) from the area circled and downward to the right. Try to avoid snapping to the gridlines so that the circle is drawn in the center and leave a margin at the edges.
23
57.From the Appearance panel, click the More Swatches button to open the More Swatches menu. 58.From the More Swatches menu, click on the Swatch Options button and select Import Swatch Library.
59.Navigate to \Labs\ Assets and select Fabrikam_Swatc hLibrary.xml. 60.Click Open to open the file. This file contains Fabrikam’s official swatch and will be more convenient than manually selecting colors.
24
61.In the Appearance panel, click on the Fill button to ensure we’re working with the Fill brush. 62.Click on the More Swatches menu and select the dark blue color in the Fabrikam_Swatc hLibrary section.
63.Click on the Stroke button and select None for the brush.
25
64.Change the Opacity to 100.
65.From the main menu, select Edit | Copy. 66.From the main menu, select Edit | Paste in Front. 67.Use the down arrow key to move the newly pasted circle downward roughly 6 pixels below the original (press the down arrow key 8-10 times).
26
68.Repeat the process to create a total of five evenly-spaced circles.
27
69.Press V to activate the Selection tool. Hold the Shift key and click on each of the circles, as well as the white rectangle behind it. 70.Right-click on one of the selected items and select Group from the context menu.
71.Press V to activate the Selection tool. 72.Click on the title bar to select it. 73.From the Edit Rectangle panel, change the Corner Radius to 7.
28
74.In the Toolbox, click and hold the Ellipse button to access its alternative tools menu. Select the Rectangle tool.
75.Draw a rectangle on the title bar that is roughly one-third its height. This rectangle will provide a shine on the title bar. 76.Use the up arrow key to move the newly drawn rectangle upward and toward the center of the title bar.
29
77.From the Appearance panel, change the Fill to white and the Opacity to 60.
78.Click on the Stroke button and select None.
79.Draw a rectangle on the title bar that is roughly 25% of the width of the title bar. This rectangle will contain the name of the application.
30
80.Use the arrow keys to center the rectangle vertically. 81.From the Appearance panel, change the Fill to black and the Opacity to 50.
31
82.Click on the Stroke button and change its brush to use a dark yellow. Also change the Width to 2.
83.Click on the Text button in the Toolbox to activate the Text tool.
84.Click on the left side of the application name rectangle and type Fabrikam Video Player.
32
85.From the Text panel, change the font size to 20.
86.Click on the Selection button in the Toolbox to activate the Selection tool. Note that we can use the shortcut V key, provided we Esc out of the active text region (or else it would type the ‘v’). 87.Click on the title text to select it. 88.Use the arrow keys to fit the text inside the title bar. 89.Click on the Text button in the Toolbox to activate the Text tool.
33
90.Highlight the Fabrikam part of the title. 91.From the Appearance panel, change the text fill to a dark yellow.
92.Highlight the Video Player part of the title.
93.From the Appearance panel, change the text fill to white.
94.From the Text panel, change the Font Decoration to Italic.
34
95.In the Toolbox, click and hold the Rectangle button to access its alternative tools menu. Select the Ellipse tool.
96.Hold the Shift key while dragging to draw a small circle near the right side of the title bar. This will serve as our minimize button. 97.Use the arrow keys to center the circle vertically.
35
98.From the Appearance panel, change the Fill to black and the Opacity to 60.
99.From the Appearance panel, change the Stroke to black and the Width to 1. 100.Next to the Opacity box, click on the Unlink fill and opacity sliders button to unlink their values. Now we can change the opacity of one without updating the other. 101.Change the Stroke Opacity to 100. 36
102.Click on the Pen button in the Toolbox to activate the Pen tool.
103.Click inside the left side of the circle to set the first point. 104.Hold the Shift key and click inside the right side of the circle to draw a straight line. 105.From the Appearance panel, change the Stroke to white and Width to 3.
37
106.The button should now look similar to this screenshot.
107.Press Ctrl+Shift+A to deselect everything. 108.Hold the Shift key, then click on the circle and line (in that order) to select them both. 109.From the Align dropdown at the bottom of Expression Design, select Align | Vertical Centers to align the line with the vertical center of the circle.
38
110.From the Align dropdown at the bottom of Expression Design, select Align | Horizontal Centers to align the line with the horizontal center of the circle. 111.From the main menu, select Edit | Copy. 112.From the main menu, select Edit | Paste in Front. 113.Use the right arrow to move the newly pasted button to the right of the original. 114.Move the mouse near the outside of a corner of the inner rectangle until the rotation cursor appears.
39
115.Click and drag to rotate the inner rectangle. Hold the Shift key to snap to 45 degree angles. 116.Release the mouse when the line is diagonally downward.
40
117.From the main menu, select Edit | Copy. 118.From the main menu, select Edit | Paste in Front. 119.Rotate the inner rectangle so that it is diagonally downward, forming an X.
120.The canvas should now look similar to this screenshot.
41
121.In the Toolbox, click and hold the Ellipse button to access its alternative tools menu. Select the Rectangle tool.
122.From the Create Rectangle panel, change the Corner Radius to 0. 123.Draw a rectangle in the dark blue region directly under the title bar. This rectangle represents the thumbnail of the currently playing video.
124.From the bottom of Expression Design, click on the Unlink width and height sliders toggle button.
42
125.Change the Width to 400 and the Height to 300. Although this size is much larger than we will use, it has the 4x3 proportions we want to maintain for the videos and thumbnails. 126.Click on the Link width and height sliders toggle button to constrain proportions. 127.Change the Height to 65. The Width will automatically update. 128.Use the arrow keys to position the thumbnail entirely within the dark blue section of the left panel.
43
129.From the Appearance panel, change the Fill to a pink color. This element is a placeholder for future use, so the color can look outof-place.
130.Using the Appearance panel, change the stroke to None.
131.From the main menu, select Edit | Copy. 132.From the main menu, select Edit | Paste In Front. 133.Using the Appearance panel, change the stroke to white.
44
134.Using the Appearance panel, change the fill to black. This rectangle’s purpose is to provide a border for the thumbnail. 135.From the main menu, select Arrange | Order | Send Backward.
136.Click on the Text button in the Toolbox to activate the Text tool.
137.Click next to the middle of the thumbnail and type “Name of Video”. The text color may be hard to read on the dark background.
45
138.Highlight the text. 139.From the Appearance panel, change the Fill to white.
140.From the Text panel, change the Font decoration to Regular and the Font size to 18. 141.Click on the Selection button in the Toolbox to activate the Selection tool. 142.Reposition the video name text so that it appears near the top of the panel.
46
143.From the main menu, select Edit | Copy. 144.From the main menu, select Edit | Paste In Front. 145.Use the right arrow key to move the newly pasted text to the right of the video name. This text will represent the video duration. 146.From the Appearance panel, change the Fill to use the bright yellow color from the Fabrikam swatch.
47
147.From the Text panel, change the Font decoration to Italic.
148.Click on the Text button in the Toolbox to activate the Text tool.
149.Change the duration label’s text to 00:00.
150.Click on the Selection button in the Toolbox to activate the Selection tool.
48
151.Click on the video name to select its text. 152.From the main menu, select Edit | Copy. 153.From the main menu, select Edit | Paste In Front. 154.From the Text panel, change the Font size to 13.
155.Highlight the text and change it to Abstract of Video.
156.The canvas should now look similar to this screenshot.
49
157.Click on the Selection button in the Toolbox to activate the Selection tool.
158.Select the thumbnail to select it.
159.Hold the Alt key and drag the thumbnail downward onto the lighter blue rectangle. Holding the Alt key when dragging makes a copy of the original object. This new rectangle will be a placeholder for the currently playing video.
50
160.Hold the Shift key while resizing the video placeholder to reach from the bottom of the preview panel to the guide near the bottom of the canvas.
161.From the main menu, select Edit | Copy. 162.From the main menu, select Edit | Paste In Front. 163.Using the Appearance panel, change the stroke to white. 164.Using the Appearance panel, change the fill to black.
51
165.From the main menu, select Arrange | Order | Send Backward.
166.Drag a box that touches the video thumbnail and its border, as well as the name, abstract, and duration of the video. Note that this selection will also include the design elements underneath the visible selections.
52
167.Holding the Shift key, click on the blue and dark blue background rectangles where shown in this screenshot. The result should be that only the video informationspecific elements are selected.
168.Right-click on the thumbnail placeholder and select Group to group these elements together.
169.Click on the Pen button in the Toolbox to activate the Pen tool.
53
170.Click inside the left edge of the grey rectangle to create the first point. 171.Click inside the right edge of the grey rectangle to create a straight line. This line represents the rail for our timeline slider. 172.From the Appearance panel, change the Fill to None.
173.Change the Stroke to white.
54
174.In the Toolbox, click and hold the Rectangle button to access its alternative tools menu. Select the Polygon tool.
175.Click and drag inside the grey rectangle, roughly in the horizontal center, to create a small triangle. Hold the Shift key to snap to 45degree angles before releasing. This triangle represents the thumb for our timeline slider.
55
176.From the Appearance panel, change the Fill to use the bright yellow from the Fabrikam swatch.
177.Change the Stroke to black.
56
178.In the Toolbox, click and hold the Polygon button to access its alternative tools menu. Select the Rectangle tool.
179.Underneath the timeline slider, draw a square by holding the Shift key while dragging the shape. This square will represent our play button.
57
180.From the Appearance panel, change the Fill to the Fabrikam blue.
181.Press Z to activate the Zoom tool. 182.Drag a small box around the play button to zoom in on it.
58
183.Click on the Rectangle button in the Toolbox to activate the Rectangle tool.
184.Draw a rectangle inside the top of the play button that has a height of around 1/3 of the play button. There should be a margin between the sides of the rectangle and the play button.
185.From the Edit Rectangle panel, change the Corner Radius to 5.
59
186.From the Appearance panel, change the Fill to a gradient brush.
187.Select the first gradient stop and change its color to white.
60
188.Select the second gradient stop and change its color to white and its Stop Alpha to 0.
189.Change the Stroke to None.
190.Click on the Gradient Transform button in the Toolbox to activate the Gradient Transform tool.
61
191.Drag the gradient transform from the top of the rectangle to the bottom.
192.From the Edit Rectangle panel, change the Corner Radius to 5. 193.In the Toolbox, click and hold the Pen button to access its alternative tools menu. Select the Delete Anchor Point tool.
194.Click on the two top anchor points to delete them. This will square off the top of the shape.
62
195.Click on the Direct Selection button in the Toolbox to activate the Direct Selection tool. 196.Holding the Shift key, select the top left anchor point and the top right anchor points.
197.Use the up arrow to move the anchor points toward the top of the button, which will make the highlight shape larger.
63
198.From the Appearance panel, change the Opacity to 30.
199.Press V to activate the Selection tool. 200.Press Ctrl+Shift+A everything. 201.Hold the shift key, then click on the button and its highlight to select them both.
64
202.From the main menu, elect Arrange | Group to pair these objects into a group. 203.From the main menu, select Edit | Copy. 204.From the main menu, select Edit | Past In Front. 205.Use the right arrow to move the newly pasted button to the right of the original. This button will be our pause button. 206.Repeat the paste and move the new group to add a third button to the right. This button will be our stop button. 207.Select the triangle on the timeline slider.
65
208.Hold the Alt key and drag a copy of the triangle onto the left button.
209.From the main menu, select Arrange | Order | Bring to Front. 210.Hold the Shift key while rotating the arrow to have it point to the right.
211.From the Appearance panel, change the Fill to white.
66
212.Change the Stroke to the Fabrikam bright yellow.
213.Click on the Rectangle button in the Toolbox to activate the Rectangle tool.
214.From the Create Rectangle panel, change the Corner Radius to 15.
67
215.Draw a thin rectangle on the left side of the play button triangle. This is half of the pause button and we’re drawing it here so that we can easily size it up against the play button. 216.Move the rectangle onto the pause button (the middle one).
217.From the main menu, select Edit | Copy. 218.From the main menu, select Edit | Paste in Front. 219.Use the right arrow key to move the second half of the pause symbol to the right of the first half.
68
220.Click on the Rectangle button in the Toolbox to activate the Rectangle tool.
221.Press Ctrl+Shift+A to deselect the rectangle. 222.From the Create Rectangle panel, change the Corner Radius to 3. 223.Hold the Shift key and draw a square next to the triangle on the play button, but slightly smaller. 224.Move the new square onto the stop button (the right one).
69
225.The canvas should now look similar to this screenshot.
226.From the main menu, select File | Open…. 227.Navigate to \Labs\ Assets and select Fabrikam_Logo. design. 228.Click Open to open the file.
70
229.Press V to activate the Selection tool. 230.Select the entire logo by drawing a selection box around it. 231.From the main menu, select Edit | Copy. 232.Switch back to the video player design file. 233.From the main menu, select Edit | Paste in Front. 234.Move the newly pasted logo to the top right corner of the window. 235.Select the logo. 236.Right-click the selected logo and select Ungroup from the context menu. 237.Press Ctrl+Shift+A to deselect everything.
71
238.Holding the Shift key, select each path in the “Fabrikam” text by clicking on it. 239.In the Appearance panel, change the Fill of the selected paths to use white. 240.Press Ctrl+Shift+A to deselect everything. 241.Holding the Shift key, select each path in the “Incorporated” text (as well as the logo’s horizontal line) by clicking on it.
72
242.In the Appearance panel, change the Fill of the selected paths to use the Fabrikam yellow.
243.Select all paths from the logo. This can be done by holding the Shift key and clicking on each path. 244.From the Effects panel, click the Add Effect button and select Effects | Outer Glow to apply an outer glow effect to the logo.
73
245.Select the Outer Glow effect. 246.Change the Size to 1 and the Opacity to .5.
247.The canvas should now look similar to this screenshot.
74
248.Click on the Rectangle button in the Toolbox to activate the Rectangle tool.
249.Draw a rectangle underneath the logo section, using the bottom edge of the dark yellow rectangle as an upper edge. This rectangle will be the top button of a scrollbar. 250.From the bottom of Expression Design, click on the Unlink width and height sliders toggle button. 251.Change the Height to 15.
75
252.From the Appearance panel, change the Fill to the Fabrikam bright yellow.
253.Change the Stroke to None.
254.Ensure the rectangle is snapped to the guides on its right and left and is resting against the dark yellow rectangle above it. You may need to zoom in to check on this.
76
255.Hold the Alt key and drag the triangle from the timeline slider onto the top scrollbar area.
256.From the main menu, select Arrange | Order | Bring to front. 257.Holding the Shift and Alt keys, resize the triangle from the center so that it fits within the scrollbar button area.
77
258.From the main menu, change the Stroke to white.
259.Change the Fill to black.
260.Holding the Shift key, click on the rectangle behind the triangle to select them both.
78
261.Hold the Alt key and drag a copy of the pair of elements to the bottom of the canvas. The copied rectangle should still snap to the same guides as its original. 262.Move the mouse near the corner of the rectangle until the rotation cursor appears. 263.Hold the Shift key and rotate the pair of elements 180-degrees so that the arrow points downward. 264.Click on the play button to select it.
79
265.Hold the Alt key and drag a copy of the button to the top of the queued videos area, directly underneath the top scrollbar button. The left side of the button should snap to the left guide and the top of the button should meet the bottom of the scrollbar button. 266.Right-click the button and select Ungroup to ungroup them.
267.Press Ctrl+Shift+A to deselect the elements. 268.Select the background rectangle and drag it across
80
269.From the bottom of Expression Design, change the Height of the queued video background to 72. 270.Click on the Direct Selection button in the Toolbox to activate the Direct Selection tool. 271.Click on the top right anchor point, then hold the Shift key and click on the other two right anchor points to select them as well. 272.Drag the group of points to the right side of the background rectangle. Hold the Shift key to ensure the lines are kept straight.
81
273.Click on the current video information and hold the Alt key while dragging onto the video queue area to make a copy. 274.From the main menu, select Arrange | Order | Bring to Front. 275.Holding the Alt and Shift keys, resize the video group to fit within the background vertically. This group only needs to be made a little bit smaller to fit nicely. 276.Select the video info group, the background rectangle, and the highlight rectangle by holding the Shift key while clicking on each. 277.From the main menu, select Arrange | Group.
82
278.From the main menu, select Edit | Options | General…. 279.In the Options dialog, click on the Units and Grids tab to open that section. 280.Change Stack gap size to 0. 281.Press OK to close the dialog.
282.Select the media item group from the right panel by clicking on it. 283.From the main menu, select Edit | Copy. 284.From the main menu, select Edit | Paste in Front. 285.Repeat the paste 4 more times (for a total of 6 items). Note that they will all be pasted in the same place, so it will appear as though only one is visible.
83
286.Select the 6 media items by dragging a selection that overlaps them. This will also select one of the background rectangles.
287.Hold the Shift key and click in the specified area to deselect the background yellow rectangle from the group.
288.From the bottom of Expression Design, select Stack | Downward to stack the panels.
84
289.The six queued video items should now be laid out top to bottom as shown in this screenshot.
290.Click on the center white grid splitter to select it. 291.Right-click the grid splitter and select Arrange | Bring to Front to bring it to the front of the design.
85
292.The final canvas should look similar to this screenshot.
293.From the main menu, select File | Export…. 294.In the Export dialog, click Save to use the VideoPlayer_UI. xaml file name.
86
295.In the Export XAML dialog, click Export to export the file.
87
Expression Blend End-to-End Exercise Contents Contents................................................................................................................71 Background...........................................................................................................71 Exercise 1 – Setting Up The Project.......................................................................72 Exercise 2 – Layout...............................................................................................79 Exercise 3 – Button Controls...............................................................................113 Exercise 4 – Slider Controls.................................................................................123 Exercise 5 – GridSplitter Controls........................................................................129 Exercise 6 – ViewBox Controls............................................................................135 Exercise 7 – Video Controls & Triggers...............................................................177 Exercise 8 –Event Handlers.................................................................................185 Exercise 9 –Data Binding....................................................................................191 Exercise 10 –Customizing The Application Window.............................................196 Exercise 10 –Customizing The Application Window
Background We’ve been commissioned by Fabrikam to develop a new media player. Working with XAML exported from Expression Design, we’re going to turn a design vision into an application reality. This manual is intended as a guide for designing the user interface and does not delve into the same level of detail that you would normally use when designing a production application. During the course of this lab, you may find it useful to zoom in and out when dealing with finely-tuned pixel locations, as well as element heights and widths. However, strict adherence to exact locations and dimensions is not critical, so please don’t worry too much about matching the screenshots exactly.
88
Exercise 1 – Setting Up The Project Steps
Screenshots
1. Select Start | All Programs, Microsoft Expression | Microsoft Expression Blend. 2. From the main menu, select File | New Project…. 3. In the Create New Project dialog, change the Name to VideoPlayer and click OK.
89
4. In the top right corner of Expression Blend, locate the Project panel. 5. In the Project panel, find the Files panel and right-click the VideoPlayer project node. 6. Select Add Existing Item… from the context menu.
90
7. In the Add Existing Item dialog, navigate to the \VideoPlayer_Asset s folder. 8. Select the following files in the folder and press Open to add them to the project: ○
Playlist.xml is an XML file that contains a test playlist.
○
Testvideo.w mv is a video to test with.
○
VideoPlayer_ UI .xaml is the exported design file that contains our UI elements.
(note: do NOT select VideoPlayerControls.c s at this time)
91
9. In the Files panel, right-click the VideoPlayer project node. 10.Select New Folder from the context menu to create a new project folder.
11.Click once on the New Folder1 folder. After a short pause, the folder name will become editable. 12.Change the name to BitmapUIElements and press Enter. This folder will contain the bitmap elements referenced by the VideoPlayer_UI.xa ml file.
92
13.The folder should now appear similar to this screenshot.
14.Right-click the BitmapUIElements project folder and select Add Existing Item… from the context menu.
93
15.In the Add Existing Item dialog, navigate to the \BitmapUIElements folder. 16.Select all files in the folder and press Open to add them to the project.
17.Click on the white triangle next to the BitmapUIElements project folder to collapse it in the view. You may expand and collapse folders as needed throughout this lab.
94
18.In the Files panel, right-click the VideoPlayer project node. 19.Select New Folder from the context menu to create a new project folder.
20.Click once on the New Folder1 folder. After a short pause, the folder name will become editable. 21.Change the name to media and press Enter. 22.Right-click the media project node and select New Folder from the context menu. 23.Change the folder’s name to thumbs. This folder will contain the thumbnails referenced by our test playlist file.
95
24.Right-click the thumbs project node and select Add Existing Item… from the context menu.
25.In the Add Existing Item dialog, navigate to the \VideoPlayer_Asset s\ media\thumbs folder. 26.Select all files in the folder and press Open to add them to the project.
96
27.Right-click the media project node and select New Folder from the context menu. 28.Change the folder’s name to videos. This folder will contain the videos referenced by our test playlist file. 29.Right-click the videos project node and select Add Existing Item… from the context menu.
30.In the Add Existing Item dialog, navigate to the \VideoPlayer_Asset s \media\videos folder. 31.Select all files in the folder and press Open to add them to the project.
97
32.The project should now look similar to this screenshot.
98
Exercise 2 – Layout Steps
Screenshots
33.On the lower left side of Expression Blend, locate the Objects and Timeline panel. 34.Click on the Window node to select it.
99
35.In the top right section of Expression Blend, click on the Properties tab to select it. 36.In the Layout panel, change the Width to 850 and the Height to 580.
100
37.In the Objects and Timeline panel, right-click the LayoutRoot node and select Change Layout Type | Viewbox.
38.Click on the Project tab to open it. 39.Double-click VideoPlayer_UI.xa ml to open it.
101
40.In the Objects and Timeline panel, right-click VideoPlayer_UI_de sign and select Copy from the context menu.
41.Switch back to Window1.xaml. The easiest way to do this is to click on its tab at the top of the workspace. 42.In the Objects and Timeline panel, right-click the LayoutRoot node and select Paste. This will paste all of the design elements from the source XAML into the main window.
102
43.The workspace should now look similar to this screenshot. Notice that there are some white borders on the right and left of the pasted artwork. This is because the viewbox is slightly shorter (smaller height) than the pasted content, so it has resized it to fit, resulting in the artwork’s width to be slightly smaller than the viewbox’s. 44.Click on the LayoutRoot element to select it.
103
45.In the Properties panel, locate the Appearance panel and change the Stretch to Fill. This will cause a slight distortion of the pasted visual assets, but it will be addressed later on when we remove the application window’s title bar.
46.Double-click the VideoPlayer_UI_de sign node to bring it into scope. Select all of the children nodes under VideoPlayer_UI_de sign and select Cut.
104
47.In the Objects and Timeline panel, right-click the VideoPlayer_UI_de sign node and select Change Layout Type | Grid to change it to a grid. Right-click the VideoPlayer_UI_de sign node and select Paste.
105
48.Click on the Hide/Show toggle button next to the Logo node to hide it. Note that we’re not changing the object’s Visibility property, but rather just hiding it while we do our design work. When an object is hidden, the eye icon disappears. It can be made visible again by clicking in the same location, at which point the eye icon will reappear. 49.Repeat the process to hide all objects in the VideoPlayer_UI_de sign container, except for the Panels object, which we will work with.
106
50.Select all objects inside the Panels container object. You can accomplish this by clicking on the first item (Rectangle) and then holding the Shift key when clicking on the last item (Splitter_Thumb).
51.Right-click the selected group and select Cut.
107
52.Right-click the VideoPlayer_UI_de sign node and select Paste to paste the design assets into that container.
53.In the Objects and Timeline panel, right-click the Rectangle node and select Rename. 54.Type BlueLeftRectangle as the new name and press Enter. 55.Repeat the process, renaming Rectangle_0 to YellowRightRecta ngle and Rectangle_1 to DarkTopRectangle .
108
56.Press the V key to use the Selection tool. 57.Making sure VideoPlayer_UI_de sign has scope, and is in Grid layout mode, move the mouse along the top edge of the VideoPlayer_UI_de sign grid to the left edge of the grid splitter. 58.Click when the orange triangle and line are visible to create a column splitter. 59.Click on the left rectangle (BlueLeftRectangle)t o select it.
109
60.In the Layout panel, change the ColumnSpan to 1 and the Right Margin to 0. This will make the rectangle resize to reach the column splitter as it’s moved.
61.In the Objects and Timeline panel, click on the Splitter node to select it.
110
62.In the Layout panel, change the ColumnSpan to 1 and the Right Margin to -8. This will ensure that the right side of the splitter (which is 8 pixels) will always be 8 pixels to the right of the column splitter. In other words, the left side of the grid splitter will always be on the column splitter. 63.You can test out the resizing behavior by dragging the column splitter left and right. 64.If you move the splitter, the easiest way to reset it is to select Edit | Undo Move Gridline from the main menu.
111
65.In the Objects and Timeline panel, click on the Hide/Show toggle button next to the TitleBar node to make it visible. 66.Click on the TitleBar node to select it.
67.In the Objects and Timeline panel, right-click the TitleBar node and select Change Layout Type | Grid.
112
68.Expand the Logo node. 69.Right-click the Logo_7 node and select Cut.
70.Right-click the VideoPlayer_UI_de sign node and select Paste.
71.Right-click the Panels node and select Delete.
113
72.Right-click the Logo node and select Delete.
73.Right-click the Logo_7 node and select Rename. 74.Change the name to Graphic_Logo.
75.On the workspace, click on the logo’s right anchor point to remove its anchoring to the right side.
114
76.In the Objects and Timeline panel, right-click the SelectedVideo node and select Order | Bring to Front.
77.Click on the Hide/Show toggle button next to the SelectedVideo node to make it visible in the designer. Then right-click the SelectedVideo node, and choose View XAML. In the XAML, delete the d:IsLayer=”True” property as shown below.