1. Trang chủ
  2. » Công Nghệ Thông Tin

Apress foundation expression blend 2 building applications in WPF and silverlight mar 2008 ISBN 1590599764 pdf

378 244 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 378
Dung lượng 8,4 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

In this book, you’ll: Learn the Blend 2 and Visual Studio 2008 development environments Create designs using Blend 2’s unique tools Use XAML and C# to add interactivity to your designs

Trang 1

In this book, you’ll:

Learn the Blend 2 and Visual Studio 2008 development environments

Create designs using Blend 2’s unique tools

Use XAML and C# to add interactivity to your designs

Publish your Rich Media Applications to the Web using Silverlight

Foundation Expression Blend 2:

Building Applications in WPF and Silverlight

Create fantastic Rich Media Applications in Microsoft Expression Blend 2

Move your applications to the Web using WPF and Silverlight Add video and advanced 3D to your desktop and web applications

uS $39.99 Pc-compatible only

Available from Apress

Building Applications in WPF and Silverlight

Trang 3

Foundation Expression Blend 2

Building Applications in WPF

and Silverlight

Victor Gaudioso

Trang 4

Matt Wade, Tom Welsh

Cover Image Designer

Corné van Dooren

Interior and Cover Designer

the copyright owner and the publisher.

ISBN-13 (pbk): 978-1-59059-976-1 ISBN-10 (pbk): 1-59059-976-4 ISBN-13 (electronic): 978-1-4302-0612-5 ISBN-10 (electronic): 1-4302-0612-8 Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1 Trademarked names may appear in this book Rather than use a trademark symbol with every occurrence of a trademarked name,

we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of

the trademark.

Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013 Phone 1-800-SPRINGER, fax 201-348-4505, e-mail orders-ny@springer-sbm.com, or visit www.springeronline.com.

For information on translations, please contact Apress directly at 2855 Telegraph Avenue, Suite 600, Berkeley, CA 94705.

Phone 510-549-5930, fax 510-549-5939, e-mail info@apress.com, or visit www.apress.com.

Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use eBook versions and licenses are also available for most titles For more information, reference our Special Bulk Sales–eBook Licensing web page at

www.apress.com/info/bulksales.

The information in this book is distributed on an “as is” basis, without warranty Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work.

The source code for this book is freely available to readers at www.friendsofed.com in the Downloads section.

Credits

Manufacturing Director

Tom Debolski

Trang 5

I would like to dedicate this book to my loving wife, Shay, who always believed in me and pushed me to reach for the stars.

I would also like to dedicate this book to my three beautiful kids,

Brianna, Tristan, and Luke.

Finally, I would like to dedicate this book to my wonderful, close-knit family—my parents, Ralph and Elfie, and my two awesome uncles, Joseph Gaudioso and Charles Elliot.

Trang 7

About the Author xiii

About the Technical Reviewer xv

About the Cover Image Designer xvii

Acknowledgments xix

Introduction xxi

Chapter 1 Setting Up the WPF Development Environment 1

Chapter 2 The WPF/Blend Workflow and Your First WPF Application 23

Chapter 3 The Blend 2 Integrated Development Environment 53

Chapter 4 C# and XAML 91

Chapter 5 Layout Elements 99

Chapter 6 The MediaElement 117

Chapter 7 ControlTemplates, Styles, and Custom UserControls 141

Chapter 8 Events and EventHandlers 167

Chapter 9 ObservableCollections and the Data Factory 189

Chapter 10 WPF and 3D 207

Chapter 11 DependencyProperties 247

Chapter 12 Case Study A: 3DImageProject 267

Chapter 13 Case Study B: 3DTieFighterProject 293

Chapter 14 Case Study C: SilverlightPagingSystemProject 309

Chapter 15 Case Study D: SilverlightVideoPlayerProject 325

Appendix WPF and Silverlight Resources 333

Index 337

CONTENTS AT A GLANCE

Trang 9

About the Author xiii

About the Technical Reviewer xv

About the Cover Image Designer xvii

Acknowledgments xix

Introduction xxi

Chapter 1 Setting Up the WPF Development Environment 1

Downloading and installing Visual Studio 2008 Professional 3

Downloading and installing Microsoft Silverlight Tools Alpha Refresh for Visual Studio 2008 Beta 2 8

Downloading and installing Blend 2 9

Creating your first WPF project 14

Summary 21

Chapter 2 The WPF/Blend Workflow and Your First WPF Application 23

A new way of working 23

Your first WPF application: “Hello World!” 27

Getting to know Solution Explorer 29

Time for Blend 2! 30

Changing the size of the application 31

Styling the Background 32

Styling the TextBlock 34

Making the “Hello World!” application more exciting 38

Creating a WPF button 38

Creating EventTriggers for the spinBtn 41

Summary 51

Chapter 3 The Blend 2 Integrated Development Environment 53

The Blend 2 toolbar 54

The Selection tool 55

The Direct Selection tool 55

The Pen/Pencil tools 56

The Pan tool 57

CONTENTS

Trang 10

The Zoom tool 57

The Camera Orbit tool 57

The Eyedropper tool 58

The Paint Bucket tool 58

The Brush Transform tool 58

The shape tools: Rectangle, Ellipse, and Line 60

Layout controls 61

Text controls and text input controls 62

Input controls 62

The Asset Library Last Used tool 62

The Asset Library 62

The InkCanvas control 63

The TabControl 64

The Frame control 64

The Objects and Timeline panel 65

The Project panel 66

The Properties panel 67

Brushes 68

Appearance 76

Layout 78

Common Properties 79

Text 79

Transform 79

Miscellaneous 80

Search 80

The Resources panel 81

Blend development views and Workspaces 81

The Design view 82

The XAML view 82

The Split view 83

Workspaces 83

The Design Workspace 83

The Animation Workspace 84

Creating 3D objects in Blend 86

Summary 88

Chapter 4 C# and XAML 91

C# and the NET Framework 91

The NET CLR 92

Why C#? 92

XAML 96

Summary 97

Chapter 5 Layout Elements 99

The Grid 100

The Canvas 105

The StackPanel 107

Trang 11

The WrapPanel 107

The DockPanel 108

The ScrollViewer 110

The Border 111

The UniformGrid 112

The ViewBox 112

Summary 114

Chapter 6 The MediaElement 117

Playback modes 117

Independent mode 118

Clock mode 119

Switching between playback modes 119

Creating your first MediaElement project 120

Blend 2’s Make a Button feature 126

Creating the stop Button 130

Creating the pause Button 132

Creating the video toggle Button 134

Summary 138

Chapter 7 ControlTemplates, Styles, and Custom UserControls 141

The ControlTemplate 142

A Button ControlTemplate 142

Styles 147

Overriding default Styles for controls 149

Adding your Button Style to your ResourceDictionary 152

Replacing text with an image via your Button Style 153

Using your Style and ControlTemplate on multiple Button controls 155

Wiring up the home Button 158

Custom UserControls 160

Summary 164

Chapter 8 Events and EventHandlers 167

Creating an EventAndEventHandlers project 167

Click 170

DragEnter 170

DragLeave 172

DragOver 172

Drop 173

Mouse events 176

MouseDoubleClick 178

MouseDown 178

PreviewMouseDown and PreviewMouseUp 179

MouseEnter and MouseLeave 180

MouseLeftButtonDown 181

MouseLeftButtonUp 182

Trang 12

MouseRightButtonDown and MouseRightButtonUp 183

MouseWheel 185

Summary 186

Chapter 9 ObservableCollections and the Data Factory 189

Creating the ObservableCollection project 190

Importing the images 191

Creating the ObservableCollection with an Abstract factory pattern 191

Opening ObservableCollection in Blend 2 197

Doing something with the selected image 201

Summary 204

Chapter 10 WPF and 3D 207

Blend and the 3D image 208

Working with Electric Rain’s ZAM 3D 212

Working with Viewport3Ds in Blend 2 220

Creating a flyby animation 223

Importing and working with OBJ files 227

Using the 3D Tools library 233

Building a new 3DMediaElementProject 234

Wiring up the buttons in Visual Studio 2008 237

Making the video 3D with 3D Tools 238

Summary 244

Chapter 11 DependencyProperties 247

DependencyProperties demystified 247

A custom UserControl with custom DependencyProperties project 249

Creating the project 249

Styling the Rectangles and then turning them into a Button control 250

Registering the custom DependencyProperties 255

Adding an icon image to the project 258

Making the custom UserControl functional 261

Summary 265

Chapter 12 Case Study A: 3DImageProject 267

Creating the 3DImageProject 268

Adding images to the project 268

Creating the ImageFactory 270

Styling the application and creating the DataSource 275

Making use of the DataSource 277

Creating viewing choices 280

Wiring up the RadioButton controls 284

Spinning the box 286

Summary 290

Trang 13

Chapter 13 Case Study B: 3DTieFighterProject 293

Importing a model from ZAM 3D 294

Creating the 3DTieFighterProject 295

Cleaning the XAML 296

Creating the buttons 297

Creating the Storyboard animations 299

Styling the background 302

Adding descriptive text to a 3D plane 303

Coding the text in Visual Studio 304

Summary 307

Chapter 14 Case Study C: SilverlightPagingSystemProject 309

Creating the SilverlightPagingSystemProject 310

Setting up various page properties 311

Creating the navigation buttons 313

Creating the content Canvas container and the content pages 316

Creating the functionality in Visual Studio 319

Summary 322

Chapter 15 Case Study D: SilverlightVideoPlayerProject 325

Creating the SilverlightVideoPlayerProject 325

Creating the functionality in Visual Studio 2008 329

Summary 331

Appendix WPF and Silverlight Resources 333

References 333

Blogs 334

Tutorials 334

Tools 335

Community sites 335

Professional WPF/Silverlight development resources 335

Index 337

Trang 15

Victor Gaudioso is a senior software application engineer at Identity

Mine, a top-tier software company specializing in designing anddeveloping cutting-edge software applications in WPF and Silverlight,creating customized WPF/Blend and Silverlight training programs,and creating tools for designers and developers Because Victor’scompany is a Gold Vendor for Microsoft, they have worked withFortune 500 companies such as Microsoft Games for Windows,Harrah’s, Mattel, NBC/Universal, Disney, Best Buy, GameStop, VivendiUniversal Games, and New Line Cinema, among others Victor alsoteaches a WPF/Silverlight course at R Blank’s Rich Media Institute inVenice, California Victor travels around the world to give seminarsand/or private instruction on WPF/Silverlight to companies such asAdobe and RMI in Toronto and Vancouver Victor, a former Flash/ActionScript engineer, stillstays active in the Flash community by writing articles and tutorials on www.actionscript.org, where he is also a moderator

ABOUT THE AUTHOR

Trang 17

Jason Cook is a software engineer and user interface designer based

in Hollywood, California He has a highly decorated background indeveloping Rich Media Applications, winning more than a dozencoveted industry awards over the last ten years Jason has built anumber of groundbreaking applications for industry-leading enter-tainment and consumer products clients such as ABC, NBC/Universal,Disney, Mattel, MTV, VH1, Honda, New Line Cinema, Sony ComputerEntertainment America, Sony Pictures, and Touchstone Pictures.Jason has led seminars, conducted professional training programs,and offered personalized consulting for Fortune 500 softwarecompanies

ABOUT THE TECHNICAL REVIEWER

Trang 19

Corné van Dooren designed the front cover image for this

book After taking a brief from friends of ED to create a new

design for the Foundation series, he worked at combining

technological and organic forms, with the results nowappearing on this and other books’ covers

Corné spent his childhood drawing on everything at handand then began exploring the infinite world of multimedia—and his journey of discovery hasn’t stopped since His mantrahas always been “The only limit to multimedia is the imagi-nation,” a saying that keeps him moving forward constantly.Corné works for many international clients, writes featuresfor multimedia magazines, reviews and tests software, authorsmultimedia studies, and works on many other friends of EDbooks You can see more of his work at and contact himthrough his web site, www.cornevandooren.com

If you like Corné’s work, be sure to check out his chapter in New Masters of Photoshop: Volume 2

(friends of ED, 2004)

ABOUT THE COVER IMAGE DESIGNER

Trang 21

I would like to acknowledge the people who helped to make this publication possible First andforemost, I would like to acknowledge my good friend and mentor Andrew Whiddett, who took

me under his wing and has taught and continues to teach me ever inventive ways to developapplications I would also like to acknowledge my friend John Grden, who forced me to embracethe principles of object-oriented programming, and my wonderful aunt, Zan Gaudioso, whohelped me with a ton of authoring questions Further, I would like to acknowledge the team atApress/friends of Ed: my go-getter project manager whom I have come to think of as more of afriend than colleague, Kylie Johnston; my editor, Ben Renow-Clarke, whom I overworked with

my horrible punctuation; my copy editor, Ami Knox, with her incredible attention to detail; and

my production editor, Laura Esterman, who put it all together into what you see now I wouldalso like to acknowledge my friends over at Electric Rain And finally, I acknowledge my verytalented technical editor and personal friend, Jason Cook, who helped me to keep my factscorrect, my tutorials functional, and my explanations clear Thank you all from the bottom of

my heart, I couldn’t have done it without any single one of you

ACKNOWLEDGMENTS

Trang 23

Welcome to Foundation Expression Blend 2: Building Applications in WPF and Silverlight! I am

very excited about this book, as I love Windows Presentation Foundation (WPF) and Silverlight,and I have a passion for teaching them both Throughout the course of the book, I am going totake you step by step from being a novice in Blend/WPF/Silverlight to being a skilled practi-tioner, able to create your own dynamic Rich Media Applications with animations, stunningeffects, and even 3D objects As well as these innovative tools from Microsoft, you will also usesome third-party applications that will really make your creations visually stunning

Because this technology is so new, only a handful of people in the world know how to develop

in it, and those who can are compensated very well and are highly sought after It’s a rapidlyexpanding market, and more and more companies are looking for Silverlight and WPFdevelopers—if you have those skills, then you’ll be a developer in demand! To give you anexample from the real world, the company I work for, Identity Mine (www.identitymine.com), isalways on the lookout for talented WPF and Silverlight developers, and if someone were toapproach us with a portfolio of skills similar to those you’ll learn in this book, we’d pretty muchhire that person on the spot! And that doesn’t just go for us; Silverlight and WPF are hot topics,and there are many more companies out there looking designers and developers who can usethem well In fact, if you’ve worked through this book and think you’ve got what it takes, feelfree to e-mail your résumé with code samples to me at wpfauthor@gmail.com

So, before you roll up your sleeves and get started, let me start off by introducing you toWPF/Blend and giving you some important information about the rest of this book

Who this book is for

Throughout my career, I have purchased many technology books and then come to realize that

I was not part of the target audience for the book In order to help potential readers avoid thissituation with my book, I decided to outline exactly who this book is for This book is for you ifyou know the basics of object-oriented programming (OOP) and have some programming expe-rience in languages (such as JavaScript, ActionScript, C++, Visual Basic, Java, and C,) but havenot used WPF If you understand even just a little about OOP, you can benefit from this bookand start to develop in WPF; however, if you do not have any experience in any of these lan-

guages, I suggest you buy a beginners guide on C# to go through first Beginning C# 2008: From

Novice to Professional by Christian Gross (Apress, 2007) is a good book and will give you far

more information than you will need to make good use of this title

INTRODUCTION

Trang 24

What this book will teach you

Following is a complete list of what exactly this book will teach you so that you know what youwill be able to accomplish in WPF/Blend once you have completed the book You will

Understand the typical WPF/Blend workflow for creating WPF applications

Understand the Blend IDE—what tools are available and how to use them

Understand XAML and C# basics

Know the basic WPF framework element controls

Understand the WPF MediaElement and how to use it to create video and audio for yourapplication

Learn how to create reusable Styles and control templates

Understand and know how to create events and EventHandlers

Learn about and create ObservableCollections of data

Create 3D objects and know how to bring them into WPF and use them

Learn about WPF visual brushes and how to use them

Understand the difference between timelines and Storyboards and know how to usetimelines to create compelling Storyboard animations

Put all of the new knowledge you learn together to make two very fun and dynamic 3DWPF applications, as well as two Silverlight applications that you will be able to reuse asyou continue to develop in Silverlight

What WPF/Blend is and what C# and XAML are

WPF has a large number of framework elements or controls such as Buttons, Grids, andMediaElements, among others These are all written in the Extensible Application MarkupLanguage (XAML), an XML-based markup language XAML also allows you to create Storyboardanimations These UI controls can be controlled partially in the XAML by Storyboards, but forthe most part they are controlled with C# This type of structure is very similar to HTML andJavaScript, as HTML displays the content, while JavaScript adds functionality to the interactiveparts of the HTML such as mouseover effects Conversely, controls can be created in C#, but,again, most controls are created in XAML XAML can also display assets such as images, audio,and video

C# is a very robust object-oriented programming language developed by Microsoft and is part

of the NET Framework Basically, I like to think of XAML as the pretty exterior of a cool car andC# as the powerful engine under the hood So the typical way that WPF creates and displayscontent goes like this:

1. XAML describes how the controls, images, video, and other assets are shown

2. C# gives these assets their functionality

Trang 25

3. The compiler then puts the XAML UI and functionality together into an executable (EXE)file for a Windows application or a XAML browser application (XBAP) executable foronline applications.

4. The browser or Windows then displays the application

The real power of WPF is the robustness of C# and the capability of using XAML to create theinterface as well as to make use of 3D objects

What tools you will need

It is worth mentioning here that C# is created and edited in Visual Studio 2005 or C# Express,and XAML can be edited in both Blend and Visual Studio 2005 or C# Express Visual Studio 2005

is a developer tool for creating applications with the NET Framework and has been around forsome years Some of the tools offered by Visual Studio 2005 are the control toolbox for addingcontrols to an application as well as tools to assist in writing code such as IntelliSense (discussed

in Chapter 2) Blend, however, is a new instrument that allows you to create and display WPFassets such as controls and images in code or visually TheSelectionandBrush Transformtools,

as well as the various shape tools, are just a few of the features that Blend offers the developer

I will go into these and other tools in Chapter 3, and you will master these development tools inlater chapters

What Silverlight is and how it differs from WPF

Silverlight, formerly known as Windows Presentation Foundation Everywhere (WPF/E), is a platform version of WPF Basically, it is a scaled down version of WPF that can run on a Mac

cross-or PC WPF can only run on Windows Vista cross-or Windows XP with NET 3.0 cross-or later installed(Windows XP ships with NET 2) There are other differences, but most important, for me any-way, is WPF can make use of 3D objects, while Silverlight cannot without third-party plug-ins.This is because it is difficult to port 3D hardware acceleration across different platforms Theother major difference is that Silverlight 1.1 can use C#, JavaScript, and Python, among others,for its code-behind language, and Silverlight 1.0 can use only JavaScript for its code-behind lan-guage (the code that gives functionality to XAML assets), while WPF can use only C# or VisualBasic The final difference is that Silverlight integrates right into an HTML page by using theSilverlight browser plug-in, while WPF needs to be inserted into an IFrame to mix with HTMLcontent Silverlight is still being developed, so the differences I have just explained may not exist

in future Silverlight releases

Online resources

Throughout this book, I will point you to online WPF examples I have created as well as codesnippets and video tutorials In the appendix of this book, I will also point you to additionalresources that can help you grow as a WPF/Blend developer These resources include web blogs,online tutorials, code examples, and much more

Trang 26

Layout conventions

To keep this book as clear and easy to follow as possible, the following text conventions areused throughout:

Important words or concepts are normally highlighted on the first appearance in bold type.

Code is presented in fixed-width font

New or changed code is presented in bold fixed-width font.

Menu commands are written in the formMenuSubmenuSubmenu.Where I want to draw your attention to something, I’ve highlighted it like this:

Ahem, don’t say I didn’t warn you.

Trang 29

What this chapter covers:

Downloading Visual Studio 2008 Beta 2Installing Visual Studio 2008 Beta 2Downloading Microsoft Silverlight Tools Alpha Refresh for Visual Studio 2008Beta 2

Installing Microsoft Silverlight Tools Alpha Refresh for Visual Studio 2008Beta 2

Downloading Blend 2 September Preview1

Installing Blend 2Creating a WPF test application in Visual Studio 2008Creating very simple content in your WPF test applicationCompiling/running your WPF test application

Opening your WPF test application in Blend 2

SETTING UP THE WPF DEVELOPMENT ENVIRONMENT

Trang 30

Before we delve into the download and installation of the WPF/Silverlight development environment,

I feel it would be good to make certain you and your machine are able to handle the tasks that will beasked of you in this chapter This chapter assumes the following:

You have a computer that is running either Windows XP with Service Pack 2 installed or anyversion of Windows Vista

Your system has at least 1GB of RAM

Your hard drive has at least 5GB of free space available

Your PC has a relatively fast CPU

Your system has a relatively good video card

You have Internet access (high speed is preferred)

You know how to navigate the Internet

You know how to download, save, and install programs

You have a DVD burner with DVD burning software

If I have not scared you off, you can start downloading and installing the WPF/Silverlight developmentenvironment

Until recently, installing the WPF/Silverlight development environment was very difficult to do Youhad to install the Microsoft NET Framework 3.0 (if you were not running Windows Vista), MicrosoftVisual Studio 2005 or Visual C# 2005 Express, the MSDN Library for Visual Studio, Expression Blend,and finally, the Microsoft Visual Studio 2005 Extensions for Windows Workflow Foundation Thedownload and install process took a very long time, and oftentimes the install would fail Fortunately,Microsoft has streamlined the install process for WPF and Silverlight in that now you only need todownload and install Visual Studio 2008, Blend 2, and the Microsoft Silverlight Tools Alpha Refresh forVisual Studio 2008 Beta 2 (this last one is just for Silverlight development) In this chapter, I am going

to tell you how to find these downloads and then show you how to install them step by step You arethen going to open Visual Studio 2008 and create a new WPF project to ensure you have installedeverything correctly, and finally, you are going to open that same WPF project in Blend 2, again, tomake certain you have installed the WPF development environment correctly

If you want to use Windows XP for WPF development, you need to have Service Pack 2 installed, or you cannot develop in WPF (earlier versions of XP are not supported).

The installation instructions provided in this chapter are for the pre-release versions of these products Therefore, the installation instructions may change slightly with the final release of these products.

Trang 31

Downloading and installing Visual Studio 2008

Professional

Unfortunately, URLs can and do change over time For that reason, I am not going to provide you withspecific URLs to downloads I am, however, going to point you to the Microsoft Download Centerwhere you can search for the programs you will need

1. Type the following URL into your web browser:

www.microsoft.com/downloads/

2. Once you navigate there, you enter visual studio 2008 professionalin the search input box at thetop of the page as I have done in Figure 1-1 and click the Gobutton

Figure 1-1 Finding Visual Studio 2008 from the Microsoft Download Center page

With any amount of luck, you will see the results that match what I have in Figure 1-2

Figure 1-2 Your search should return the Visual Studio 2008 Beta 2 Professional Edition link.

3. Click the Visual Studio 2008 Beta 2 Professional Editionlink and then click the Downloadbutton.You will be prompted to Openor Savethe file to your local hard drive as shown in Figure 1-3

4. Choose to Savethe file on your local hard drive and make note of where you saved it It willthen start to download The file is about 3GB, so this may be a good time to make and enjoy acup (or possibly a pot) of coffee This may seem like a very long download to you, but the pre-vious installation method for Visual Studio 2008 required you to download eight files, seven ofwhich were almost a gigabyte each!

5. Once the file has finished downloading, navigate to wherever you chose to save it on your localhard drive and double-click it It will then open your default DVD burning software (mine isNero), and attempt to burn a DVD This should take under 10 minutes on most moderncomputers

This download will require you to download an image file that will, when run, require you to burn a DVD If you do not have a DVD burner, download this file onto a com- puter that does have a DVD burner.

Trang 32

Figure 1-3 Save the IMG file to your local hard drive, and

make a note of where you saved it

6. Once the DVD is complete, the fun begins! Open the DVD drive that contains the new VisualStudio 2008 Beta 2 installer DVD and close it again, and it should automatically run Some PCsmay not have autorun enabled If this is the case, use Window Explorer to navigate to yourDVD drive and double-click the setup.exe file You will then see a screen like the one inFigure 1-4

Figure 1-4 Once you run the Visual Studio 2008 Beta 2 installer DVD,

Some DVD burning software may not recognize an IMG file If this is the case, you may have to install another DVD burning software such as the trial version of MagicISO to convert the IMG file to a more common ISO file.

Trang 33

7. Click the Install Visual Studio 2008link The installer will then perform a check to make certainthat Visual Studio 2008 can be installed on your machine and which components your particu-lar machine will require to develop WPF applications (see Figure 1-5).

Figure 1-5 The Visual Studio 2008 Beta 2 installer will determine which components it needs to install on

your machine

Trang 34

8. You will then be asked to read and accept the license terms To do that, select the appropriateradio button as I have done in Figure 1-6, and click Next.

Figure 1-6 Accepting the license terms

Notice too that the product key has been entered for you and grayed out This is because Visual Studio 2008 is still in Beta form and thus free, for now Once the final product is released, you will need to purchase it and enter a valid product key to con- tinue the installation process.

Trang 35

9. The installer will then ask what features you want to install for Visual Studio 2008 Choose

Defaultlike I have done in Figure 1-7, and then click Install

Figure 1-7 Selecting the Default features

At this point, the installer will then start to install a host of components that will allow you to createWPF applications (see Figure 1-8)

Trang 36

Figure 1-8 The install process begins.

The best advice I can offer you to make the installation process easier is to be patient Personally, Ihave witnessed the installation of Visual Studio 2008 be as short as one hour and as long as two hours.Two components that take particularly long to install are the NET Framework 3.5 and Microsoft VisualStudio 2008 The good news is that this version of the installer will install components that previouslyhad to be downloaded and installed separately For example, previously you had to download andinstall the NET Framework 3.0 and the Visual Studio Tools for WPF separately

10. Once the installer has completed, click Finishand then you can move on and download andinstall the Silverlight Tools for Visual Studio

Downloading and installing Microsoft Silverlight Tools Alpha Refresh for Visual Studio 2008 Beta 2

The program you’ll download in this section allows you to create Silverlight 1.1 applications in VisualStudio 2008 This book primarily covers WPF development, but because Silverlight 1.1 is a subset ofWPF tools, much of the content is relevant to Silverlight 1.1 as well Also, later in this book, I presentsome Silverlight 1.1 tutorials

Trang 37

1. You can find the download under the “DOWNLOAD THE RUNTIME AND TOOLS” sectionlocated here: http://silverlight.net/GetStarted/.

2. Select the link that reads Microsoft Silverlight Tools Alpha Refresh for Visual Studio 2008 Beta 2(July 2007)

3. You will then be redirected to a download page Click the Downloadbutton on that page

4. When prompted, save the file to your hard drive and make a mental note of the name of thefile and where it was saved

5. When the program has finished downloading, navigate to where you saved it on your harddrive and double-click it

6. Run through the installation process It is very simple and fast (no longer than 5 minutes)

Downloading and installing Blend 2

If you already own a copy of Blend 2, you can skip this section If you do not have Blend 2, this sectionwill describe where to find and install the free trial version

1. To find the Blend 2 trial, head back to the Microsoft Download Center (located here:www.microsoft.com/downloads/) and in the search field enter blend 2 septemberlike I havedone in Figure 1-9

Figure 1-9 Navigating to the Microsoft Download Center and entering blend 2 september in the search box

Again, with any degree of luck, your search will yield the same results that mine did, as the only resultreturned to me was exactly the one I was looking for (see Figure 1-10)

Figure 1-10 My search yielded one result, and it was just the result I was looking for.

Trang 38

2. Click the Expression 2 September Previewlink, and you will be taken to the download page forMicrosoft Expression Blend 2 as I was in Figure 1-11.

Figure 1-11 Your search result should take you to the download page for Microsoft Expression Blend 2.

3. Click the Continuebutton, and you will be taken to a page asking whether you want to register

to receive the download Registration is optional, and can be skipped if you prefer Once that’sdone, you will be redirected to the page that will actually let you download the program (seeFigure 1-12)

Figure 1-12 This page will allow you to download Blend 2.

Trang 39

4. You are then asked whether you want to RunorSavethe file In my experience, I have foundthat it is best to save it locally and then run it once it has completed downloading That beingthe case, save the file to your local hard drive (making note of the file’s name and location).Once the file has completed downloading, navigate to where you saved it on your hard driveand double-click it.

5. Click Run(see Figure 1-13)

Figure 1-13 When the Open File dialog box appears, click Run.

6. Click Next(see Figure 1-14)

Figure 1-14 Click Next on the Blend 2 installation screen.

Trang 40

7. Accept the end-user license agreement and click Next(see Figure 1-15).

Figure 1-15 Accept the end-user license agreement

8. You will then be prompted to choose the setup type that best suits your needs Select Typical

(see Figure 1-16) and then click Install You will then see the Blend installer progress bar (seeFigure 1-17)

Figure 1-16 Selecting the Typical setup type

Ngày đăng: 20/03/2019, 14:14

TỪ KHÓA LIÊN QUAN