Tải bản đầy đủ

461 introducing silverlight 4

 CYAN
  MAGENTA

  YELLOW
  BLACK
  PANTONE 123 C

www.it-ebooks.info
Books for professionals by professionals ®

Dear Reader,

Ashish Ghoda, Author of
Pro Silverlight for the
Enterprise
Accelerated Silverlight 3

Companion eBook

Microsoft never stops revealing new, exciting, developer-friendly, and enterpriselevel features and capabilities of their products. Microsoft’s commitment to the
next-generation rich Internet technology platform and the relentless efforts of

the Microsoft Silverlight team are clearly demonstrated in the recently released
Silverlight 4 version.
Silverlight 4 extends the core capabilities—data and media integration capabilities—and introduces some of the basic features of any line-of-business (LoB)
application, such as printing, documents integration, reporting, rich offline capabilities (with the introduction of trusted out-of-browser applications), and local
devices (e.g., web camera and microphone) integration. Tighter integration of
Silverlight 4 with Visual Studio 2010 and .NET 4.0 and better integration of WCF RIA
Services and data binding capabilities will certainly help the designer and developer communities to develop enterprise-level LoB applications supporting the agile
development model.
A long-awaited feature—Silverlight for mobile—is finally revealed in Silverlight 4.
Silverlight 4 and Windows Mobile development tools enable development of interactive Silverlight applications for the Windows 7 Mobile Phone series. Silverlight 4
for mobile, and official support of the Google Chrome browser, make Silverlight a
truly cross-device and cross-platform technology platform.
This is a great time to be a .NET developer, but even if you aren’t, you will find
and learn that Silverlight has much to offer. This book is written for developers who
have experience with .NET but may never have taken a look at Silverlight, or who
already know Silverlight 3 and want to get familiar with Silverlight 4 features. The
book contains everything you need to feel comfortable working with Silverlight,
with several hands-on examples to show you Silverlight 4 in action.
I encourage you to apply skills you’ve gained from this book to build Silverlight
LoB applications and put them to work for your organization.
Ashish Ghoda

THE APRESS ROADMAP
See last page for details
on $10 eBook version

Beginning
Silverlight 4
Introducing
Silverlight 4

SOURCE CODE ONLINE

www.apress.com

Pro
Silverlight 4 in C#

ISBN 978-1-4302-2991-9
5 39 9 9



US $39.99

Companion
eBook Available

Introducing Silverlight 4

Introducing Silverlight 4

The EXPERT’s VOIce ® in Silverlight

Introducing

Silverlight 4
Gear up fast to develop line of business
rich internet applications using Silverlight 4

Ashish Ghoda
Ghoda

Shelve in:
.NET
User level:
Beginner–Intermediate

9 781430 229919

this print for content only—size & color not accurate

spine = 1.40625" 744 page count


www.it-ebooks.info


www.it-ebooks.info

Introducing Silverlight 4
















  
Ashish Ghoda


www.it-ebooks.info

Introducing Silverlight 4
Copyright © 2010 by Ashish Ghoda
All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means,
electronic or mechanical, including photocopying, recording, or by any information storage or retrieval
system, without the prior written permission of the copyright owner and the publisher.
ISBN-13 (pbk): 978-1-4302-2991-9
ISBN-13 (electronic): 978-1-4302-2992-6
Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with
every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an
editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the
trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not
identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to
proprietary rights.
President and Publisher: Paul Manning
Lead Editor: Jonathan Hassell
Technical Reviewer: Damien Foggon
Editorial Board: Clay Andres, Steve Anglin, Mark Beckner, Ewan Buckingham, Gary Cornell, Jonathan
Gennick, Jonathan Hassell, Michelle Lowman, Matthew Moodie, Duncan Parkes, Jeffrey Pepper,
Frank Pohlmann, Douglas Pundick, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom
Welsh
Coordinating Editor: Laurin Becker
Copy Editor: Mary Ann Fugate
Compositor: Bytheway Publishing Services
Indexer: BIM Indexing & Proofreading Services
Artist: April Milne
Cover Designer: Anna Ishchenko
Distributed to the book trade worldwide by Springer Science+Business Media, LLC., 233 Spring Street, 6th
Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springersbm.com, or visit www.springeronline.com.
For information on translations, please e-mail rights@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 available to readers at www.apress.com. You will need to answer questions
pertaining to this book in order to successfully download the code.


www.it-ebooks.info

I dedicate this book to my grandparents (Nayansukhray and Kumud Ghoda, Mahavir and
Sarla Majmudar), parents (Jitendra and Varsha Ghoda), sister (Kruti Vaishnav), and lovely
family (Pratixa, Gyan, and Anand Ghoda) whose blessings, sacrifice, continuous support,
and encouragement enabled me to achieve the dream.
—Ashish Ghoda


www.it-ebooks.info
 CONTENTS

Contents
 Contents................................................................................................................. iv
 About the Author................................................................................................. xvii
 About the Technical Reviewer ........................................................................... xviii
 Acknowledgments ............................................................................................... xix
 Introduction .......................................................................................................... xx
PART 1    Introduction to Silverlight.................................................................1
 Chapter 1: Introducing Silverlight ..........................................................................3
Cross-Platform Frameworks..............................................................................................4
Qt .............................................................................................................................................................. 4
The Java Platform..................................................................................................................................... 4
Adobe Flash/Flex/AIR................................................................................................................................ 5
Microsoft ASP.NET AJAX .......................................................................................................................... 5
Microsoft Silverlight ................................................................................................................................. 5

The History of Silverlight ...................................................................................................6
Silverlight 1 .............................................................................................................................................. 6
Silverlight 2 .............................................................................................................................................. 7
Silverlight 3 .............................................................................................................................................. 9
Silverlight 4 ............................................................................................................................................ 11

Design and Development Tools for Silverlight.................................................................14
Visual Studio........................................................................................................................................... 14
Expression Blend .................................................................................................................................... 15
SketchFlow............................................................................................................................................. 15

iv


www.it-ebooks.info
 CONTENTS

Expression Encoder ................................................................................................................................ 16
Deep Zoom Composer ............................................................................................................................ 16
Eclipse Tools for Silverlight (eclipse4SL)................................................................................................ 16

Creating a Silverlight 4–based Application......................................................................16
Working with Expression Blend.............................................................................................................. 19
Demonstrating Local Image Files Integration Using Drag-and-Drop Functionality ................................ 21

Summary .........................................................................................................................26
 Chapter 2: Silverlight Concepts ............................................................................27
Silverlight Architecture ....................................................................................................27
Silverlight and XAML........................................................................................................29
Developing a Sample Application ........................................................................................................... 29
Namespaces........................................................................................................................................... 33
Dependency Property System ................................................................................................................ 34
Type Converters...................................................................................................................................... 39
Markup Extensions ................................................................................................................................. 40

Microsoft .NET for Silverlight...........................................................................................48
Core .NET Assemblies for Silverlight Applications.................................................................................. 48
Managed Code-Behind .NET Integration ................................................................................................ 49

Summary .........................................................................................................................56
 Chapter 3: Silverlight User Interface Controls ......................................................57
Building Blocks ................................................................................................................57
DependencyObject.................................................................................................................................. 58
Threading and the user interface ........................................................................................................... 59
UIElement ............................................................................................................................................... 59
FrameworkElement ................................................................................................................................ 63
The Control Class.................................................................................................................................... 66

Enhancements in Silverlight 4 .........................................................................................68

v


www.it-ebooks.info
 CONTENTS

Layout Management and Grouping Controls ...................................................................69
Canvas .................................................................................................................................................... 69
StackPanel.............................................................................................................................................. 70
Grid ......................................................................................................................................................... 71
DockPanel............................................................................................................................................... 74
WrapPanel .............................................................................................................................................. 77
TabControl .............................................................................................................................................. 78
ViewBox.................................................................................................................................................. 80

Forms Controls ................................................................................................................81
The Button Controls ................................................................................................................................ 81
TextBox................................................................................................................................................... 85
PasswordBox.......................................................................................................................................... 87
RichTextBox............................................................................................................................................ 88
AutoCompleteBox ................................................................................................................................... 91

Data Integration and Data Manipulation Controls............................................................95
ItemsControl ........................................................................................................................................... 96
ListBox.................................................................................................................................................... 96
ComboBox .............................................................................................................................................. 98
TreeView................................................................................................................................................. 99
HeaderedItemsControl.......................................................................................................................... 102
ContentControl...................................................................................................................................... 103
HeaderedContentControl ...................................................................................................................... 103
DataGrid................................................................................................................................................ 104
DataForm.............................................................................................................................................. 104
DataPager............................................................................................................................................. 105
Label..................................................................................................................................................... 105
DescriptionViewer ................................................................................................................................ 105
ValidationSummary .............................................................................................................................. 106

vi


www.it-ebooks.info
 CONTENTS

Functional Controls........................................................................................................106
Border................................................................................................................................................... 106
GridSplitter ........................................................................................................................................... 107
TextBlock.............................................................................................................................................. 109
Popup ................................................................................................................................................... 111
ToolTipService ...................................................................................................................................... 112
ScrollViewer ......................................................................................................................................... 113
The RangeBase Class ........................................................................................................................... 115
Calendar and DatePicker ...................................................................................................................... 118
Image.................................................................................................................................................... 121
MultiScaleImage................................................................................................................................... 121
MediaElement....................................................................................................................................... 122
InkPresenter ......................................................................................................................................... 122
Dialog Boxes......................................................................................................................................... 124
WebBrowser ......................................................................................................................................... 133

Navigation......................................................................................................................134
Summary .......................................................................................................................137
PART 2    Content Integration in Silverlight Applications.............................139
 Chapter 4: Media Integration..............................................................................141
Media Integration Enhancements in Silverlight 4 ..........................................................141
Images ...........................................................................................................................142
The Image Class ................................................................................................................................... 142
Bitmap APIs .......................................................................................................................................... 147
Silverlight Hardware Acceleration ........................................................................................................ 152
Multi-scale Images and the Deep Zoom Feature.................................................................................. 155

Media (Video and Audio) ................................................................................................162
Supported Media Format...................................................................................................................... 163
Unsupported Media Format .................................................................................................................. 164

vii


www.it-ebooks.info
 CONTENTS

The MediaElement Class ...................................................................................................................... 164
Timeline Markers.................................................................................................................................. 172
Web Camera and Microphone Integration ............................................................................................ 174

Windows Azure Platform–based Hosting and Media Delivery Services for Silverlight
Applications ...................................................................................................................183
Subscribing to Windows Azure Platform Services................................................................................ 183
Publishing Silverlight Applications Video Content ................................................................................ 183

Streaming Packaged Images and Media Files...............................................................184
Summary .......................................................................................................................184
 Chapter 5: Network Communication...................................................................185
Networking Enhancements in Silverlight 4....................................................................185
Enabling Cross-Domain Communication .......................................................................185
Cross-Domain Policy Files .................................................................................................................... 186
Trusted Applications............................................................................................................................. 189

Network-Aware Applications.........................................................................................191
Consuming Web Services with WCF ..............................................................................191
Creating a WCF Service Consumable by Silverlight.............................................................................. 192
XAML to Consume Information ............................................................................................................. 195
Invoking Services from Silverlight........................................................................................................ 196
Communicating Directly over HTTP ...................................................................................................... 207

Communicating via Sockets ..........................................................................................213
Controlling Client Access via a Socket Policy Server ........................................................................... 213
The System.Net Namespace ................................................................................................................ 214
Building a Socket-Based Sample Text Chat Application ...................................................................... 217

UDP Multicast ................................................................................................................232
The UdpAnySourceMulticastClient Class.............................................................................................. 232
The UdpSingleSourceMulticastClient Class.......................................................................................... 234

viii


www.it-ebooks.info
 CONTENTS

Considerations for Using Networking ............................................................................236
Summary .......................................................................................................................236
 Chapter 6: Working with Data.............................................................................237
Enhancements in Silverlight 4 .......................................................................................237
Displaying Data..............................................................................................................238
Data Binding ......................................................................................................................................... 238
Type Converters.................................................................................................................................... 262
StringFormat......................................................................................................................................... 263
BindingBase.FallbackValue and BindingBase.TargetNullValue Properties........................................... 264
Binding to String Indexers .................................................................................................................... 265
The DataGrid Control ............................................................................................................................ 266
The DataForm Control........................................................................................................................... 279
The CollectionViewSource .................................................................................................................... 284

WCF Data Services.........................................................................................................284
Entity Data Model (EDM)....................................................................................................................... 285
Silverlight Client Library for WCF Data Services................................................................................... 286
Silverlight Application using WCF Data Service.................................................................................... 289

Processing XML Data.....................................................................................................299
Parsing XML.......................................................................................................................................... 300
Serializing XML..................................................................................................................................... 301
Using LINQ ............................................................................................................................................ 302

Saving State on the Client .............................................................................................303
Summary .......................................................................................................................309
PART 3    Improving User Experience...........................................................311
 Chapter 7: Extending User Experience of LoB Applications...............................313
Enhancements in Silverlight 4 .......................................................................................313
Drag-and-Drop Functionality .........................................................................................314
Properties of UIElement to Enable Drag-and-Drop Functionality.......................................................... 314

ix


www.it-ebooks.info
 CONTENTS

Events of UIElement to Enable Drag-and-Drop Functionality ............................................................... 314
Processing Dropped File(s)................................................................................................................... 315
Developing an Example ........................................................................................................................ 315

Mouse-Wheel Support ...................................................................................................324
Developing an Example ........................................................................................................................ 324
Limitations............................................................................................................................................ 326

Right-Click Context Menu Support ................................................................................326
Printing Capabilities.......................................................................................................329
PrintDocument Class ............................................................................................................................ 330
PrintPageEventArgs Class .................................................................................................................... 330
Implementing the Printing Function ..................................................................................................... 331

Clipboard Access ...........................................................................................................336
Globalization and Localization of Silverlight Applications .............................................338
Globalization ......................................................................................................................................... 338
Localization .......................................................................................................................................... 342

Enhancements in XAML Features ..................................................................................352
Flexible Root XAML Namespace ........................................................................................................... 352
XmlnsDefinitionAttribute....................................................................................................................... 353
Direct Content....................................................................................................................................... 353
Whitespace Handling............................................................................................................................ 353
Custom IDictionary Support.................................................................................................................. 354

Summary .......................................................................................................................354
 Chapter 8: Styling and Templating .....................................................................355
Enhancements in Silverlight 4 .......................................................................................355
Using Styles ...................................................................................................................355
Style Inheritance/Style Cascading........................................................................................................ 360
Style Override/Style Resetting.............................................................................................................. 361
Merged Resource Dictionaries ............................................................................................................. 363

x


www.it-ebooks.info
 CONTENTS

Implicit Styling...................................................................................................................................... 364
Style Setter........................................................................................................................................... 365

Using Control Templates................................................................................................366
Creating a Control Template................................................................................................................. 366
Control Templates for Other Controls ................................................................................................... 376
Developing a Templated Control........................................................................................................... 378

Summary .......................................................................................................................380
 Chapter 9: Graphics ............................................................................................383
Enhancements in Silverlight 4 .......................................................................................383
2D Graphics ...................................................................................................................383
Using Geometries ................................................................................................................................. 384
Using Shapes........................................................................................................................................ 391

Transforms ....................................................................................................................395
Translation............................................................................................................................................ 396
Rotation ................................................................................................................................................ 396
Skewing................................................................................................................................................ 397
Scaling.................................................................................................................................................. 398
Arbitrary Linear Transforms ................................................................................................................. 399
Combining Multiple Transformations ................................................................................................... 401
Composite Transformation ................................................................................................................... 401

3D Effects Using Perspective Transforms......................................................................403
Pixel Shaders.................................................................................................................405
Brushes..........................................................................................................................407
The SolidColorBrush ............................................................................................................................. 408
The Tile Brushes................................................................................................................................... 408
The Gradient Brushes ........................................................................................................................... 410

Transparency and Opacity Masks..................................................................................412
Summary .......................................................................................................................414

xi


www.it-ebooks.info
 CONTENTS

 Chapter 10: Animation ........................................................................................415
Introduction to Silverlight Animation .............................................................................415
Timelines .......................................................................................................................416
AutoReverse ......................................................................................................................................... 418
BeginTime............................................................................................................................................. 419
Duration................................................................................................................................................ 420
FillBehavior........................................................................................................................................... 421
RepeatBehavior .................................................................................................................................... 421
SpeedRatio ........................................................................................................................................... 421

Storyboards and Animation ...........................................................................................423
From/To/By Animations ........................................................................................................................ 423
Keyframe Animations ........................................................................................................................... 431
Animation Easing.................................................................................................................................. 437

Procedural Animation ....................................................................................................441
Bubble User Control.............................................................................................................................. 441
DemoPage User Control........................................................................................................................ 443

Animating with Expression Blend ..................................................................................447
3D Animation .................................................................................................................451
Summary .......................................................................................................................452
PART 4    Advanced Topics...........................................................................453
 Chapter 11: Advanced Silverlight Features ........................................................455
Silverlight Navigation Framework .................................................................................455
Understanding the Navigation Framework........................................................................................... 457
Implementing Custom Navigation ........................................................................................................ 463

Deep Linking..................................................................................................................471
Search Engine Optimization...........................................................................................471
Additional References........................................................................................................................... 474

xii


www.it-ebooks.info
 CONTENTS

Out-of-Browser Functionality ........................................................................................474
Enabling the Out-of-Browser Functionality .......................................................................................... 475
Installing Out-of-Browser Applications ................................................................................................ 477
Uninstalling Out-of-Browser Applications ............................................................................................ 480
Trusted Out-of-Browser Applications ................................................................................................... 481
Customizing Out-of-Browser Applications ........................................................................................... 482
Working with the Networking and Offline APIs..................................................................................... 484
Incorporating an Updated Version ........................................................................................................ 488
Files Management ................................................................................................................................ 490
Notification API ..................................................................................................................................... 494
COM Automation................................................................................................................................... 497

Commanding Support ....................................................................................................502
The Model Class ................................................................................................................................... 504
The ViewModel Class............................................................................................................................ 504
The View.xaml File................................................................................................................................ 505

Cross-Silverlight Application Communication ...............................................................506
Using the System.Windows.Messaging Namespace............................................................................ 507
Seeing an Example in Action ................................................................................................................ 508

Summary .......................................................................................................................514
 Chapter 12: Threading in Silverlight...................................................................515
Using Threading.............................................................................................................515
The Thread Class .................................................................................................................................. 516
Creating and Managing Threads .......................................................................................................... 519
The Dispatcher ..................................................................................................................................... 521
The BackgroundWorker Class .............................................................................................................. 522
Working with Shared Data.................................................................................................................... 526

Using Timers..................................................................................................................529
Using the DispatcherTimer ................................................................................................................... 530

xiii


www.it-ebooks.info
 CONTENTS

Using the System.Threading Timer ...................................................................................................... 531

Summary .......................................................................................................................532
 Chapter 13: WCF RIA Services and Silverlight for Mobile..................................533
WCF RIA Services for Silverlight ....................................................................................533
Setting Up a Development Environment............................................................................................... 534
Introducing Silverlight Business Application Template ........................................................................ 535
Additional References........................................................................................................................... 545

Silverlight for Windows Mobile ......................................................................................546
Setting Up a Development Environment............................................................................................... 546
Developing a Sample Twitter Application............................................................................................. 546

Summary .......................................................................................................................553
 Chapter 14: Dynamic Languages and Dynamic .NET for Silverlight ..................555
Dynamic Languages ......................................................................................................555
Dynamic Languages for Silverlight ................................................................................556
IronRuby ............................................................................................................................................... 556
IronPython ............................................................................................................................................ 557

Dynamic Language Runtime (DLR) for Silverlight..........................................................557
DLR Scripting Assemblies .................................................................................................................... 558
The Microsoft.Scripting.Silverlight.DynamicApplication Class ............................................................. 559

Setting Up the Development Environment.....................................................................560
The Traditional Approach with the Chiron.exe File............................................................................... 560
The “Just-Text” Approach.................................................................................................................... 561

Creating Silverlight Applications Using the “Just-Text” Approach................................564
Hosting a HTML File.............................................................................................................................. 564
In-Line IronRuby/IronPython Code in Hosting HTML File ...................................................................... 564
In-Line XAML Code in Hosting HTML File ............................................................................................. 565
Externalizing XAML and IronRuby/IronPython Code ............................................................................. 565

xiv


www.it-ebooks.info
 CONTENTS

Developing an Interactive Bing Maps Application with Silverlight and IronRuby ..........566
Installing Microsoft Bing Maps Silverlight Control SDK........................................................................ 566
Include Bing Maps Control to the Solution ........................................................................................... 566
Create a SilverlightMap.xaml File......................................................................................................... 568
Creating a SilverlightMap.html File ...................................................................................................... 568
Adding 3D Animation within the SilverlightMap.xaml File.................................................................... 569
Creating a SilverlightMap.rb IronRuby File and Adding Map Mode ...................................................... 570
Add Rotate Map Capabilities ................................................................................................................ 571
Targeting Pre-defined Locations .......................................................................................................... 575

Summary .......................................................................................................................577
 Chapter 15: Security ...........................................................................................579
.NET Security in the CLR ................................................................................................579
Silverlight Security Model..............................................................................................580
Enhancements in Silverlight 4 .......................................................................................582
Configuring Silverlight 4 Applications to Run with Elevated Trust ....................................................... 582
Digitally Signing Out-of-Browser Silverlight Applications .................................................................... 585
Elevated-Trusted Silverlight Applications vs. Partially Trusted Silverlight Applications ...................... 587

Application-Level Security.............................................................................................589
Securing Information in Transit ............................................................................................................ 589
Securing Information with Cryptography.............................................................................................. 589
Same-Domain and Cross-Domain Communication .............................................................................. 607
Division of Responsibility...................................................................................................................... 609

Summary .......................................................................................................................612
PART 5    Testing and Deploying Silverlight RIAs.........................................613
 Chapter 16: Testing and Debugging....................................................................615
Testing ...........................................................................................................................615
Unit Testing .......................................................................................................................................... 616
Automated User Interface Testing ........................................................................................................ 627

xv


www.it-ebooks.info
 CONTENTS

Debugging .....................................................................................................................633
The Debugging Process........................................................................................................................ 633
Conditional Compilation........................................................................................................................ 634
Debugging Silverlight Applications with Visual Studio ......................................................................... 635
Handling Unhandled Exceptions ........................................................................................................... 640

Summary .......................................................................................................................644
 Chapter 17: Packaging and Deploying Silverlight Applications .........................645
Client Considerations.....................................................................................................645
Disabling Silverlight Plug-In Using Web Browser................................................................................. 646
Silverlight Configuration ....................................................................................................................... 647

Silverlight Deployment Package Definition....................................................................650
Core Runtime Library............................................................................................................................ 651
Silverlight Application Package (XAP File)............................................................................................ 651
In-Package and On-Demand Files ........................................................................................................ 656

Hosting Silverlight Applications.....................................................................................659
Server-Side Silverlight RIA Deployment ............................................................................................... 661
Custom Initialization Parameters.......................................................................................................... 662
Embedding Silverlight Plug-Ins to the Web Page ................................................................................. 663
Custom HTML Object Element Error Handling for Better User Experience ........................................... 667

Silverlight and the Build Process...................................................................................667
Building a Silverlight Application Visual Studio Project (.csproj) with MSBuild.................................... 668
Building a Silverlight Application MsBuild Project (.proj) with MSBuild ............................................... 670

Silent Installer for Silverlight Out-of-Browser Applications...........................................673
Summary .......................................................................................................................674
 Index ...................................................................................................................675

xvi


www.it-ebooks.info

About the Author

Awarded with a British Computer Society (BCS) Fellowship, Ashish Ghoda is
a customer-focused and business values–driven senior IT executive with over
13 years of IT leadership, enterprise architecture, application development,
and technical and financial management experience.
He is founder and president of Technology Opinion LLC, a unique
collaborative venture striving for strategic excellence by providing partnerships
with different organizations and the IT community. He is also the associate
director at a Big Four accounting firm.
Ashish actively contributes to the IT community. He provides strategic
advice about achieving IT goals and defining the product and technology road
maps of organizations, conducts training in and speaks on IT leadership areas
and Microsoft technologies, and architects and develops customer-centric
software services.
He is the author of Accelerated Silverlight 3 (co-authored with Jeff Scanlon)and Pro Silverlight for the
Enterprise from Apress, and several articles on Microsoft technologies and IT management areas for
MSDN Magazine, TechnologyOpinion.com, and advice.cio.com. He is also the technical reviewer of
Silverlight Recipes Second Edition and Silverlight 3 Recipes, also from Apress. Ashish reviews research
papers submitted for the Innovative and Collaborative Business and E-Business tracks of the European
Conference on Information Systems (ECIS) and World Multi-Conference on Systemics, Cybernetics, and
Informatics (WMSCI).
He has a master’s degree in information systems from New Jersey Institute of Technology (NJIT)
and has earned Microsoft Certified Professional (MCP) and Microsoft Certified Application Developer
(MCAD) certifications in .NET.
Visit his company site at www.technologyopinion.com, and blog site at www.silverlightstuff.net to
get the latest information on the technology and different services.

xvii


www.it-ebooks.info
 INTRODUCTION

About the Technical Reviewer

Damien Foggon is a developer, writer, and technical reviewer in cutting-edge technologies and has
contributed to more than 50 books on .NET, C#, Visual Basic, and ASP.NET. He is the co-founder of the
Newcastle-based user group NEBytes (online at www.nebytes.net), is a multiple MCPD in .NET 2.0 and
.NET 3.5, and can be found online at http://blog.littlepond.co.uk.

xviii


www.it-ebooks.info
 INT

Acknowledgments
I would like to thank Jonathan Hassell, my editor, for giving me another opportunity and remaining
confident that I could finish one of the first few books on Silverlight 4 at a highly accelerated speed.
The schedule was really aggressive, and positive support from Laurin Becker (coordinating editor),
Damien Foggon (technical reviewer), Mary Ann Fugate (copy editor), and other Apress team members
enabled me to achieve this task successfully. They deserve special thanks for their thorough review and
quick turnarounds, which helped me develop quality content in the given challenging timeline.
Jay Nanavaty, a senior consultant of Technology Opinion, has been working with me since my first
book, Pro Silverlight for the Enterprise, published last year. He dedicated long hours helping me develop
many examples for this book. Without his excellent work and through knowledge of Silverlight and .NET,
it would have been very challenging for me to finish the book.
With blessings from God and encouragement from my grandparents, parents, and in-laws, I was
able to accomplish this task successfully. My wife, Pratixa, and two little sons, Gyan (6 years old) and
Anand (2 years old), have continued their positive support, which enabled me to finish my third
consecutive book. I thank my family for their unbelievable cooperation and encouragement, and for
keeping their faith in me during this ambitious endeavor.
Ashish Ghoda
Founder and President, Technology Opinion LLC
www.technologyopinion.com

xix


www.it-ebooks.info
 INTRODUCTION

Introduction
Microsoft Silverlight is a cross-browser, cross-platform, and cross-device plug-in for developing the
next-generation, media-rich, interactive line-of-business (LoB) rich Internet applications (RIAs) in an
agile and cost-effective way.
In only nine months, after releasing Silverlight 3 in July 2009, Microsoft released Silverlight 4 in April
2010. The Silverlight 3 version introduced out-of-browser capabilities to work in the disconnected mode
and access to local file systems, and it helped professionals to develop data-driven applications easily.
Silverlight 4 introduced support to Windows 7 Mobile phones and highlighted demanded features, such
as printing, documents integration, reporting, rich offline capabilities, and local devices to develop lineof-business (LoB) data-driven RIAs. The following are some of them:








Introduction of new and enhanced LoB RIA features, such as content printing
capability, right-click context menus, drag-and-drop and copy-and-paste
functionalities, notification windows, enhanced data controls and data binding
features, full access to key boards, and integration with microphones and web
cameras.
Silverlight applications with elevated trust as out-of-browser applications enable
access to “My*” Folders for Windows (and on Mac mapped to related places).
Introduction of implicit theming and multicast UDP networking will help to
improve the overall end-user experience.
Visual Studio 2010 enables the user interface development for Silverlight 4 (and
Silverlight 3) RIAs and introduces better data binding and WCF RIA services
integration with other enhancements to improve the development experience.
Silverlight 4 and Windows Phone development tools enable development of
interactive Silverlight applications for Windows 7 Mobile Phone series.

This book covers all aspects of Silverlight 4 with numerous examples, providing you hands-on
experience. Starting by covering Silverlight and its different versions, I will provide a detailed
understanding of WPF, XAML, styling and templates, and Silverlight user controls (including new
controls introduced in Silverlight 4) so you can build an effective presentation layer for your Silverlight
applications. I will also cover the data integration capabilities and related user controls to show how to
integrate with the different data sources using WCF services and LINQ. We will dive into details of
seamless media integration and animations capabilities along with introducing Silverlight 4 key LoB
features such as printing, right-click context menus, drag-and-drop functionalities, and notification
windows. In addition, we will cover some advanced features such as the navigation framework, out-of-

xx


www.it-ebooks.info
 INTRODUCTION

browser functionality, Windows mobile integration, and the networking and security capabilities of
Silverlight 4. This book will also give you details on how to unit test Silverlight applications and the best
way to build and deploy these applications.
Introducing Silverlight 4 aims to get you up to speed as quickly and efficiently as possible on
Silverlight 4, and I hope you find what you’re looking for within its pages.

xxi


www.it-ebooks.info


www.it-ebooks.info

PART 1
■ ■ ■

Introduction to Silverlight


Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay

×