Introducing Silverlight 4 (eBook)

(Autor)

eBook Download: PDF
2011 | 1st ed.
744 Seiten
Apress (Verlag)
978-1-4302-2992-6 (ISBN)

Lese- und Medienproben

Introducing Silverlight 4 -  Ashish Ghoda
Systemvoraussetzungen
34,99 inkl. MwSt
  • Download sofort lieferbar
  • Zahlungsarten anzeigen

Introducing Silverlight 4 brings you up to speed with version 4 of Silverlight quickly and efficiently. The book builds off your understanding of the basics of .NET coding and WPF, allowing your journey to Silverlight 4 proficiency to be as quick and painless as possible. The text highlights where coding techniques are similar to other, more established areas of the .NET framework. Likewise, when your existing coding habits lead you to a syntax or conceptual 'gotcha,' the text points that out, too.

This book provides you with fast-track coverage of all the most important elements of the Silverlight 4 technology ranging from XAML to standard controls, from dealing with media to networking, from testing to deployment. It also reveals features introduced with Silverlight 4 and offers guidance on how to best utilize them. The book concludes with a pair of fully worked sample applications for you to follow through, because nothing reinforces your understanding of how concepts fit together as much as looking at finished code.

It is assumed that readers are already be comfortable with the workings of the .NET framework. Knowledge of Expression Blend is useful, but not mandatory: you'll learn the Blend techniques that you need to know as you go through the book. By the end, you will have followed a sound, concise path to mastery of Silverlight 4.



Ashish Ghoda is a customer-focused and business values-driven information technology executive with over 11 years of leadership, technical and financial management, and enterprise application architect experience. Currently, he is associate director at a 'Big Four' accounting firm.
Introducing Silverlight 4 brings you up to speed with version 4 of Silverlight quickly and efficiently. The book builds off your understanding of the basics of .NET coding and WPF, allowing your journey to Silverlight 4 proficiency to be as quick and painless as possible. The text highlights where coding techniques are similar to other, more established areas of the .NET framework. Likewise, when your existing coding habits lead you to a syntax or conceptual 'gotcha,' the text points that out, too. This book provides you with fast-track coverage of all the most important elements of the Silverlight 4 technology ranging from XAML to standard controls, from dealing with media to networking, from testing to deployment. It also reveals features introduced with Silverlight 4 and offers guidance on how to best utilize them. The book concludes with a pair of fully worked sample applications for you to follow through, because nothing reinforces your understanding of how concepts fit together as much as looking at finished code. It is assumed that readers are already be comfortable with the workings of the .NET framework. Knowledge of Expression Blend is useful, but not mandatory: you ll learn the Blend techniques that you need to know as you go through the book. By the end, you will have followed a sound, concise path to mastery of Silverlight 4.

Ashish Ghoda is a customer-focused and business values-driven information technology executive with over 11 years of leadership, technical and financial management, and enterprise application architect experience. Currently, he is associate director at a "Big Four" accounting firm.

Title Page 1
Copyright Page 2
Table of Contents 4
About the Author 17
About the Technical Reviewer 18
Acknowledgments 19
Introduction 20
PART 1 Introduction to Silverlight 22
Chapter 1 Introducing Silverlight 23
Cross-Platform Frameworks 24
Qt 24
The Java Platform 24
Adobe Flash/Flex/AIR 25
Microsoft ASP.NET AJAX 25
Microsoft Silverlight 25
The History of Silverlight 26
Silverlight 1 26
Silverlight 2 27
Silverlight 3 29
Silverlight 4 31
Design and Development Tools for Silverlight 34
Visual Studio 34
Expression Blend 35
SketchFlow 35
Expression Encoder 36
Deep Zoom Composer 36
Eclipse Tools for Silverlight (eclipse4SL) 36
Creating a Silverlight 4–based Application 36
Working with Expression Blend 39
Demonstrating Local Image Files Integration Using Drag-and- Drop Functionality 41
Summary 46
Chapter 2 Silverlight Concepts 47
Silverlight Architecture 47
Silverlight and XAML 49
Developing a Sample Application 49
Defining User Interface Using XAML Code 50
Defining User Interface Using Code-Behind 50
The XAML Controls Structure 52
Namespaces 53
Dependency Property System 54
Dependency Properties 55
The Root of Visual Elements: DependencyObject 59
Type Converters 59
Markup Extensions 60
Resource Dictionaries, Referencing Static Resources, and Implicit Styling 60
Data Binding 64
Template Binding 67
Microsoft .NET for Silverlight 68
Core .NET Assemblies for Silverlight Applications 68
Managed Code-Behind .NET Integration 69
Summary 76
Chapter 3 Silverlight User Interface Controls 77
Building Blocks 77
DependencyObject 78
Threading and the user interface 79
UIElement 79
FrameworkElement 83
The Control Class 86
Enhancements in Silverlight 4 88
Layout Management and Grouping Controls 89
Canvas 89
StackPanel 90
Grid 91
DockPanel 94
WrapPanel 97
TabControl 98
ViewBox 100
Forms Controls 101
The Button Controls 101
Button 103
HyperlinkButton 103
RepeatButton 103
Toggle Buttons: CheckBox and RadioButton 104
TextBox 105
PasswordBox 107
RichTextBox 108
AutoCompleteBox 111
Data Integration and Data Manipulation Controls 115
ItemsControl 116
ListBox 116
The ListBoxItem Class 118
ComboBox 118
The ComboBoxItem Class 119
TreeView 119
The TreeViewItem Class 121
HeaderedItemsControl 122
ContentControl 123
HeaderedContentControl 123
DataGrid 124
DataForm 124
DataPager 125
Label 125
DescriptionViewer 125
ValidationSummary 126
Functional Controls 126
Border 126
GridSplitter 127
TextBlock 129
Popup 131
ToolTipService 132
ScrollViewer 133
The RangeBase Class 135
ScrollBar 135
Slider 136
ProgressBar 137
Calendar and DatePicker 138
Image 141
MultiScaleImage 141
MediaElement 142
InkPresenter 142
Strokes and StylePoints 142
Dialog Boxes 144
OpenFileDialog 145
SaveFileDialog 147
ChildWindow 150
WebBrowser 153
Navigation 154
The Frame Class 154
The Page Class 156
Summary 157
PART 2 Content Integration in Silverlight Applications 158
Chapter 4 Media Integration 159
Media Integration Enhancements in Silverlight 4 159
Images 160
The Image Class 160
Bitmap APIs 165
Silverlight Hardware Acceleration 170
GPU Hardware Acceleration 171
Bitmap Caching 171
Cache and Frame Rate Counter Visualization 172
Multi-scale Images and the Deep Zoom Feature 173
Developing an Example Using Deep Zoom Composer 176
Media (Video and Audio) 180
Supported Media Format 181
Unsupported Media Format 182
The MediaElement Class 182
Timeline Markers 190
Web Camera and Microphone Integration 192
The CaptureDeviceConfiguration Class 192
The CaptureDevice, AudioCaptureDevice, and VideoCaptureDevice Classes 194
The CaptureSource Class 195
Developing an Example 197
Windows Azure Platform–based Hosting and Media Delivery Services for Silverlight Applications 201
Subscribing to Windows Azure Platform Services 201
Publishing Silverlight Applications Video Content 201
Streaming Packaged Images and Media Files 202
Summary 202
Chapter 5 Network Communication 203
Networking Enhancements in Silverlight 4 203
Enabling Cross-Domain Communication 203
Cross-Domain Policy Files 204
The crossdomain.xml File 205
The clientaccesspolicy.xml File 205
Trusted Applications 207
Network-Aware Applications 209
Consuming Web Services with WCF 209
Creating a WCF Service Consumable by Silverlight 210
XAML to Consume Information 213
Invoking Services from Silverlight 214
Silverlight Service Utility Tool 215
Asynchronous Communication 217
Handling Errors 220
Communicating Directly over HTTP 225
The WebClient Class 225
The HttpWebRequest Class 229
Communicating via Sockets 231
Controlling Client Access via a Socket Policy Server 231
The System.Net Namespace 232
The Socket Class 232
The SocketAsyncEventArgs Class 234
Building a Socket-Based Sample Text Chat Application 235
The PolicyServer Windows Service Project 236
The MessengerServer Windows Service Project 241
The Message.cs File 246
The MainPage.xaml File 246
The MainPage.xaml.cs Code-Behind File 247
Executing the Text Chat Application 248
UDP Multicast 250
The UdpAnySourceMulticastClient Class 250
The UdpSingleSourceMulticastClient Class 252
Considerations for Using Networking 254
Summary 254
Chapter 6 Working with Data 255
Enhancements in Silverlight 4 255
Displaying Data 256
Data Binding 256
Enabling Data Change Notification 261
Rich Data Binding Support in Visual Studio 2010 263
Data Validation 264
IDataErrorInfo Interface for Client-Side Validation 267
INotifyDataErrorInfo Interface for Asynchronous Server-Side Validation 269
XAML Element Data Binding / Element-to-Element Binding 278
DependencyObject Binding 279
Type Converters 280
StringFormat 281
BindingBase.FallbackValue and BindingBase.TargetNullValue Properties 282
Binding to String Indexers 283
The DataGrid Control 284
Implementing Grouping, Sorting, Filtering, and Paging 285
DataGrid Editing Events 291
DataGrid Column Sizing 292
Clipboard Support 294
Cell-Level Data Validation 295
Row-Level Data Validation 295
The DataForm Control 297
IEditableObject Interface Implementation 300
Customized Display of DataForm Fields 300
Field-Level Validation 301
The CollectionViewSource 302
WCF Data Services 302
Entity Data Model (EDM) 303
Silverlight Client Library for WCF Data Services 304
The DataServiceContext Class 304
The DataServiceQuery Class 306
The DataServiceCollection (T) Class 307
Silverlight Application using WCF Data Service 307
Create ADO .NET Entity Data Model 308
Create WCF Data Service 309
Create WCF Data Services Proxy and Retrieve the Records 312
Two-Way Binding with DataServiceCollection Class 314
Handling Deferred Content 315
Processing XML Data 317
Parsing XML 318
Serializing XML 319
Using LINQ 320
Saving State on the Client 321
Summary 327
PART 3 Improving User Experience 328
Chapter 7 Extending User Experience of LoB Applications 329
Enhancements in Silverlight 4 329
Drag-and-Drop Functionality 330
Properties of UIElement to Enable Drag-and-Drop Functionality 330
Events of UIElement to Enable Drag-and-Drop Functionality 330
Processing Dropped File(s) 331
Developing an Example 331
Defining User Control 331
Implementing Code-Behind of the User Control 333
Adding ChildWindow as an Image Viewer 337
Mouse-Wheel Support 340
Developing an Example 340
Limitations 342
Right-Click Context Menu Support 342
Printing Capabilities 345
PrintDocument Class 346
PrintPageEventArgs Class 346
Implementing the Printing Function 347
Printing the Application Screen 347
Printing Selected Control 349
Custom Printing 350
Clipboard Access 352
Globalization and Localization of Silverlight Applications 354
Globalization 354
CultureInfo Class 355
Developing an Example 356
Localization 358
Hub-and-Spoke Model 358
Implementing an Example 360
Preparing for Global Silverlight Application 368
Enhancements in XAML Features 368
Flexible Root XAML Namespace 368
XmlnsDefinitionAttribute 369
Direct Content 369
Whitespace Handling 369
Custom IDictionary Support 370
Summary 370
Chapter 8 Styling and Templating 371
Enhancements in Silverlight 4 371
Using Styles 371
Style Inheritance/Style Cascading 376
Style Override/Style Resetting 377
Merged Resource Dictionaries 379
Implicit Styling 380
Style Setter 381
Using Control Templates 382
Creating a Control Template 382
Visual State Manager (VSM) 384
Custom Button Control using Control Template 390
Control Templates for Other Controls 393
Developing a Templated Control 394
Summary 397
Chapter 9 Graphics 398
Enhancements in Silverlight 4 398
2D Graphics 398
Using Geometries 399
Simple Geometries 399
Path Geometries 402
Grouping Geometries 405
Clipping with Geometries 405
Using Shapes 406
Ellipse 407
Line 408
Rectangle 408
Polyline 408
Polygon 408
Path 408
Transforms 410
Translation 411
Rotation 411
Skewing 412
Scaling 413
Arbitrary Linear Transforms 414
Combining Multiple Transformations 416
Composite Transformation 416
3D Effects Using Perspective Transforms 418
Pixel Shaders 420
Brushes 422
The SolidColorBrush 423
The Tile Brushes 423
The ImageBrush 424
The Video Brush 424
The Gradient Brushes 425
The LinearGradientBrush 426
The RadialGradientBrush 427
Transparency and Opacity Masks 427
Summary 429
Chapter 10 Animation 430
Introduction to Silverlight Animation 430
Timelines 431
AutoReverse 433
BeginTime 434
Duration 435
FillBehavior 436
RepeatBehavior 436
SpeedRatio 436
Storyboards and Animation 438
From/To/By Animations 438
Foreground Animation: An Example 439
Shimmering Effect for Background Animation: An Example 445
Keyframe Animations 446
Interpolation 448
Animation Easing 452
Understanding Animation-Easing Functions 454
Procedural Animation 456
Bubble User Control 456
DemoPage User Control 458
Animating with Expression Blend 462
3D Animation 466
Summary 467
PART 4 Advanced Topics 468
Chapter 11 Advanced Silverlight Features 469
Silverlight Navigation Framework 469
Understanding the Navigation Framework 471
The Frame Class 471
Start-Up Page and Application Navigation Features 473
Navigation Pages 476
Navigation History and Integration with Browser 476
Implementing Custom Navigation 477
The INavigationContentLoader Interface 477
Extending the Example 479
Deep Linking 485
Search Engine Optimization 485
Additional References 488
Out-of-Browser Functionality 488
Enabling the Out-of-Browser Functionality 489
Installing Out-of-Browser Applications 491
In-Browser Install: Default Option 491
In-Browser Install: Custom Developed Option 492
Silent Install 493
Uninstalling Out-of-Browser Applications 494
The Default Option 494
The Silent Uninstall Option 494
Trusted Out-of-Browser Applications 495
Customizing Out-of-Browser Applications 496
Custom Icons 496
Window Manipulation and Customization 497
Working with the Networking and Offline APIs 498
Incorporating an Updated Version 502
Files Management 504
Notification API 508
COM Automation 511
Commanding Support 516
The Model Class 518
The ViewModel Class 518
The View.xaml File 519
Cross-Silverlight Application Communication 520
Using the System.Windows.Messaging Namespace 521
Seeing an Example in Action 522
Creating the Sender Silverlight Application 523
Creating the Receiver Silverlight Application 524
Hosting the Sender and Receiver Applications on the Same Page 526
Summary 528
Chapter 12 Threading in Silverlight 529
Using Threading 529
The Thread Class 530
Creating and Managing Threads 533
The Dispatcher 535
The BackgroundWorker Class 536
Working with Shared Data 540
Using Timers 543
Using the DispatcherTimer 544
Using the System.Threading Timer 545
Summary 546
Chapter 13 WCF RIA Services and Silverlight for Mobile 547
WCF RIA Services for Silverlight 547
Setting Up a Development Environment 548
Introducing Silverlight Business Application Template 549
Running the Default Project 551
Implementing Windows Authentication 554
ADO .NET Entity Data Model for Data Integration 555
Domain Service Class for Data Integration 556
Reading and Displaying Data from the Data Source 557
Updating Data to the Data Source 559
Additional References 559
Silverlight for Windows Mobile 560
Setting Up a Development Environment 560
Developing a Sample Twitter Application 560
Create a Windows Phone Application Project 561
Defining the User Interface 561
Code-Behind for Twitter Integration 564
Testing Silverlight Windows Mobile Application Using Windows Phone 7 Emulator 565
Summary 567
Chapter 14 Dynamic Languages and Dynamic .NET for Silverlight 568
Dynamic Languages 568
Dynamic Languages for Silverlight 569
IronRuby 570
IronPython 570
Dynamic Language Runtime (DLR) for Silverlight 570
DLR Scripting Assemblies 571
The Microsoft.Scripting.Silverlight.DynamicApplication Class 572
Setting Up the Development Environment 573
The Traditional Approach with the Chiron.exe File 573
The “Just-Text” Approach 574
Creating Silverlight Applications Using the “Just-Text” Approach 577
Hosting a HTML File 577
In-Line IronRuby/IronPython Code in Hosting HTML File 577
In-Line XAML Code in Hosting HTML File 578
Externalizing XAML and IronRuby/IronPython Code 578
Developing an Interactive Bing Maps Application with Silverlight and IronRuby 579
Installing Microsoft Bing Maps Silverlight Control SDK 579
Include Bing Maps Control to the Solution 579
Include Bing Maps Control within the dlr.xap File 580
Include Bing Maps Control As an External ZIP File 580
Create a SilverlightMap.xaml File 581
Creating a SilverlightMap.html File 581
Adding 3D Animation within the SilverlightMap.xaml File 582
Creating a SilverlightMap.rb IronRuby File and Adding Map Mode 583
Add Rotate Map Capabilities 584
Targeting Pre-defined Locations 588
Summary 590
Chapter 15 Security 591
.NET Security in the CLR 591
Silverlight Security Model 592
Enhancements in Silverlight 4 594
Configuring Silverlight 4 Applications to Run with Elevated Trust 594
Digitally Signing Out-of-Browser Silverlight Applications 597
Elevated-Trusted Silverlight Applications vs. Partially Trusted Silverlight Applications 599
Application-Level Security 601
Securing Information in Transit 601
Securing Information with Cryptography 601
Hash Algorithms and Message Authentication Codes 602
Encrypting/Decrypting Data 604
User Access Control 608
Same-Domain and Cross-Domain Communication 619
Division of Responsibility 621
Summary 624
PART 5 Testing and Deploying Silverlight RIAs 625
Chapter 16 Testing and Debugging 626
Testing 626
Unit Testing 627
Silverlight Unit Testing Framework 627
Automated User Interface Testing 638
UI Spy Tool 639
Implementing UI Automation Testing 640
Debugging 644
The Debugging Process 644
Conditional Compilation 645
Debugging Silverlight Applications with Visual Studio 646
Controlling the Debugger 647
Configuring Startup for Debugging 648
Debugging Out-of-Browser Applications 651
Handling Unhandled Exceptions 651
Summary 655
Chapter 17 Packaging and Deploying Silverlight Applications 656
Client Considerations 656
Disabling Silverlight Plug-In Using Web Browser 657
Silverlight Configuration 658
Silverlight Deployment Package Definition 661
Core Runtime Library 662
Silverlight Application Package (XAP File) 662
Application Manifest File 664
Application Startup Assembly File 665
Optional Files 667
In-Package and On-Demand Files 667
Copy Local Property 668
Build Action Property 669
Hosting Silverlight Applications 670
Server-Side Silverlight RIA Deployment 672
Setting the IIS MIME Type 673
Same-Domain and Cross-Domain Deployment 673
Custom Initialization Parameters 673
Embedding Silverlight Plug-Ins to the Web Page 674
HTML object Element 674
Silverlight.js JavaScript Helper File 677
Custom HTML Object Element Error Handling for Better User Experience 678
Silverlight and the Build Process 678
Building a Silverlight Application Visual Studio Project (.csproj) with MSBuild 679
Building a Silverlight Application MsBuild Project (.proj) with MSBuild 681
Silent Installer for Silverlight Out-of-Browser Applications 684
Summary 685
Index 686

Erscheint lt. Verlag 11.1.2011
Zusatzinfo 744 p.
Verlagsort Berkeley
Sprache englisch
Themenwelt Informatik Programmiersprachen / -werkzeuge NET Programmierung
Mathematik / Informatik Informatik Software Entwicklung
Mathematik / Informatik Informatik Web / Internet
Schlagworte Animation • Control • Debugging • .NET Framework • Technology • Windows Presentation Foundation • XAML
ISBN-10 1-4302-2992-6 / 1430229926
ISBN-13 978-1-4302-2992-6 / 9781430229926
Haben Sie eine Frage zum Produkt?
PDFPDF (Wasserzeichen)
Größe: 28,1 MB

DRM: Digitales Wasserzeichen
Dieses eBook enthält ein digitales Wasser­zeichen und ist damit für Sie persona­lisiert. Bei einer missbräuch­lichen Weiter­gabe des eBooks an Dritte ist eine Rück­ver­folgung an die Quelle möglich.

Dateiformat: PDF (Portable Document Format)
Mit einem festen Seiten­layout eignet sich die PDF besonders für Fach­bücher mit Spalten, Tabellen und Abbild­ungen. Eine PDF kann auf fast allen Geräten ange­zeigt werden, ist aber für kleine Displays (Smart­phone, eReader) nur einge­schränkt geeignet.

Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür einen PDF-Viewer - z.B. den Adobe Reader oder Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür einen PDF-Viewer - z.B. die kostenlose Adobe Digital Editions-App.

Zusätzliches Feature: Online Lesen
Dieses eBook können Sie zusätzlich zum Download auch online im Webbrowser lesen.

Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.

Mehr entdecken
aus dem Bereich
Expert-backed advice for information system design, down to .NET and …

von Jean-Philippe Gouigoux

eBook Download (2024)
Packt Publishing (Verlag)
38,39
Build practical projects with Blazor, .NET MAUI, gRPC, GraphQL, and …

von Mark J. Price

eBook Download (2023)
Packt Publishing Limited (Verlag)
35,99