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

Beginning silverlight 4 in c, 3rd edition

417 109 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

Cấu trúc

  • Prelim

  • Contents at a Glance

  • Contents

  • About the Author

  • About the Technical Reviewer

  • Acknowledgments

  • Introduction

    • Who Should Read This Book

    • How This Book Is Organized

  • Welcome to Silverlight 4

    • The Evolution of the User Interface

    • Rich Internet Application Solutions

    • What Is Silverlight?

    • Benefits of Silverlight

      • Cross-Platform/Cross-Browser Support

      • Cross-Platform Version of the .NET Framework

      • Use of Familiar Technologies

      • Small Runtime and Simple Deployment

    • The Silverlight Development Environment

    • New Features in Silverlight 4

      • Improved Performance

    • Summary

  • Introduction to Visual Studio 2010

    • What Is Visual Studio?

    • What’s New in Visual Studio 2010?

      • Support for Multiple Monitors

      • Zoom Support for Source Editor

      • Improved IntelliSense

      • Add References Performance

      • Reference Highlighting

      • Box Selection

      • Call Hierarchy Window

      • Code Generation

      • Extension Manager

    • Building Your First Silverlight Application in Visual Studio

      • Try It Out: Hello World in Silverlight 4

      • Hosting Your Silverlight Application: Web Site or Web Application?

      • Using a Visual Studio Web Site

      • Using a Visual Studio Web Application Project

    • Summary

  • Layout Management in Silverlight

    • Layout Management

    • The Canvas Panel

      • Try It Out: Using the Canvas Panel

      • Filling the Entire Browser Window with Your Application

    • The StackPanel Control

      • Try It Out: Using the StackPanel Control

      • Try It Out: Nesting StackPanel Controls

    • The Grid Control

      • Try It Out: Using the Grid Control

      • Try It Out: Nesting a Grid and Spanning a Column

    • The WrapPanel Control

      • Try It Out: Using the WrapPanel Control

    • The DockPanel Control

      • Try It Out: Using the DockPanel Control

    • Summary

  • Silverlight Controls

    • Setting Control Properties

      • Attribute Syntax

      • Element Syntax

      • Type-Converter-Enabled Attributes

      • Attached Properties

    • Nesting Controls Within Controls

    • Handling Events in Silverlight

      • Try It Out: Declaring an Event in XAML

      • Try It Out: Declaring an Event Handler in Managed Code

    • The Border Control

    • User Input Controls

      • Try It Out: Working with the TextBox Control

      • Try It Out: Working with the RadioButton and CheckBox Controls

    • Extended Controls

      • Adding an Extended Control

      • Try It Out: Using the GridSplitter

    • Summary

  • Data Binding and Silverlight List Controls

    • Data Binding

      • The Binding Class

      • Try It Out: Simple Data Binding in Silverlight

    • Element to Element Binding

      • Try It Out: Element to Element Binding

    • The DataGrid Control

      • Try It Out: Building a Simple DataGrid

      • The Columns Collection

      • DataGridTextColumn

      • DataGridCheckBoxColumn

      • DataGridTemplateColumn

      • Try It Out: Building a DataGrid with Custom Columns

    • The ListBox Control

      • Default and Custom ListBox Items

      • Try It Out: Building a ListBox with Custom Content

    • New Data Binding Features in Silverlight 4

      • Data Binding and String Formatting

      • TargetNullValue and FallBackValue Extensions

    • Summary

  • Silverlight Toolkit

    • Overview of the Silverlight Toolkit

      • Mature/SDK Quality Band

      • Stable

      • Preview

      • Experimental

      • Installing the Toolkit

    • Toolkit Controls

      • Accordion

      • Try It Out: Working with the Accordion Control

    • AutoCompleteBox

      • TabControl

    • ViewBox

    • Modal Windows

      • Try It Out: Using the Modal Child Window

    • Summary

  • Data Access and Networking

    • Data Access in Silverlight Applications

    • Accessing Data Through Web Services

      • Try It Out: Accessing Data Through a WCF Service

    • Accessing Services from Other Domains

    • Accessing Data Through Sockets

    • Summary

  • Navigation Framework

    • Frame and Page Object

      • Try It Out: Creating a Silverlight Navigation Application

    • Benefits of the Navigation Framework

      • Deep Linking

    • The NavigationService Object

      • Try it Out: Using the NavigationService Object

    • Passing Data to Navigation Pages

      • Try it Out: Passing Data to Navigation Pages

    • Uri Mapping

      • Try it Out: Uri Mapping and the Navigation Framework

    • Silverlight Navigation Application Template

      • Try it Out: Using the Silverlight Navigation Application Template

    • Using Multiple Frames

      • Try it Out: Using Multiple Frames

    • Summary

  • Isolated Storage in Silverlight

    • Working with Isolated Storage

      • Using the Isolated Storage API

      • IsolatedStorageFile

      • IsolatedStorageFileStream

      • IsolatedStorageSettings

      • Try It Out: Creating a File Explorer for Isolated Storage

      • Creating the Application Layout

      • Coding the File Explorer

      • Testing the File Explorer

    • Managing Isolated Storage

      • Viewing and Clearing Isolated Storage

      • Try It Out: Increasing the Isolated Storage Quota

    • Summary

  • System Integration and Device Support

    • Notification (Toast) API

      • Try It Out: Implementing Toast Notifications.

    • Webcam/Microphone Access

      • CaptureDeviceConfiguration Class

      • CaptureSource Class

      • Try It Out: Accessing a User’s Web Camera and Microphone

    • Working with Captured Streams

    • COM Interoperability

      • Try It Out: Executing an EXE

    • Dropping Files on a Silverlight Application

      • Drop Event

      • Try It Out: Enabling an Application As a Drop Target

    • Summary

  • Introduction to Expression Blend

    • Key Features in Expression Blend

      • Visual XAML Editor

      • Visual Studio 2010 Integration

      • Split-View Mode

      • Visual State Manager and Template Editing Support

      • World-Class Timeline

      • Try It Out: Working with Projects in Expression Blend

    • Exploring the Workspace

      • Toolbox

      • Project Panel

      • Properties Panel

      • Objects and Timeline Panel

    • Laying Out an Application with Expression Blend

      • Working with the Grid Control in Expression Blend

      • Try It Out: Editing a Layout Grid with Expression Blend

    • Summary

  • Styling in Silverlight

    • Inline Properties

      • Try It Out: Setting Inline Properties with Visual Studio

      • Try It Out: Setting Inline Properties with Expression Blend

    • Silverlight Styles

      • Try It Out: Using Styles As Static Resources

      • Defining Styles at the Application Level

      • Merged Resource Dictionaries

      • Silverlight Style Hierarchy

      • Inheriting Styles Using BasedOn

      • Implicit Styles

    • Summary

  • Transformations and Animation

    • Introduction to Silverlight Animation

      • Silverlight Storyboards

      • Types of Animations in Silverlight

    • Programmatically Controlling Animations

    • Using Expression Blend to Create Animations

      • Viewing a Storyboard in the Expression Blend Timeline

      • Try It Out: Creating an Animation with Expression Blend

    • Creating Transformations in Silverlight

      • Transformation Types

      • ScaleTransform

      • SkewTransform

      • RotateTransform

      • TranslateTransform

      • Try It Out: Using Expression Blend to Transform Silverlight Objects

    • Summary

  • Custom Controls

    • When to Write Custom Controls

    • Silverlight Control Model

      • Parts and States Model

      • Dependency Properties

    • Creating Custom Controls in Silverlight

      • Implementing Custom Functionality

      • Try It Out: Building a Custom Control

      • Setting Up the Control Project

      • Defining Properties and States

      • Defining the Control’s Appearance

      • Handling Control Events

      • Compiling and Testing the Control

    • Summary

  • Printing in Silverlight

    • The Printing API

      • PrintDocument Events

      • Determining Print Content

      • Try It Out: Implementing Simple Printing

    • Printing Custom Content

      • Try It Out: Implementing a Custom Print

    • Additional Printing Customization

      • Try It Out: Handling the BeginPrint and EndPrint Events

    • Summary

  • Deployment

    • Deploying Silverlight Applications

      • XAP Files

      • Hosting Silverlight Content

    • Application Library Caching

      • Try It Out: Exploring Assembly Caching

    • Full Screen Pinning

    • Out of Browser Support

      • Customizing the Install Application Dialog

      • Out of Browser API

      • Removing Installed Applications

    • Elevated Trust Applications

    • Summary

  • Index

    • ¦A

    • ¦B

    • ¦C

    • D

    • ¦

    • ¦E

    • ¦F

    • ¦G

    • ¦I

    • H

    • ¦

    • ¦K

    • ¦L

    • ¦J

    • ¦M

    • N

    • ¦

    • ¦O

    • ¦P

    • ¦Q

    • ¦S

    • ¦R

    • ¦T

    • ¦V

    • ¦U

    • ¦W

    • ¦X ¦Y

    • Z

    • ¦

Nội dung

  CYAN   MAGENTA   YELLOW   BLACK   PANTONE 123 C BOOKS FOR PROFESSIONALS BY PROFESSIONALS ® THE EXPERT’S VOICE ® IN SILVERLIGHT Companion eBook Available Beginning Silverlight in C# Robert Lair, Author of Beginning Silverlight Beginning Silverlight Pure ASP.NET: A CodeIntensive Premium Reference Silverlight is a powerful, exciting, and fun technology that allows you to create very rich, flexible applications quickly and easily As with any new skill, the best way to learn is to get involved and try it out Beginning Silverlight guides you through a series of carefully crafted walk-through tutorials These structured lessons give you a good understanding of the Silverlight technology and lay strong foundations from which you can build your own Silverlight applications in the future By reading this book and working through the step-by-step tutorials, you will learn to: • Master Silverlight techniques from basics to new features such as webcams, print support, COM interop, and implicit styling • Develop highly responsive web applications that have desktop-like features • Create rich user interfaces, animations, caching solutions, and more Silverlight is a technology that has a very strong future ahead of it The development community is taking it very seriously as it rapidly gains market share and out-innovates its competitors There has never been a better time to learn about Microsoft’s premier rich Internet application technology, and this book provides you with the perfect introduction Robert Lair THE APRESS ROADMAP Beginning Silverlight in C# Pro Silverlight in C# Pro Business Applications with Silverlight Introducing Silverlight Silverlight Recipes Silverlight Business Intelligence Software Companion eBook Silverlight in C# Dear Reader, Beginning Beginning Silverlight in C# Learn to build state-of-the-art Silverlight applications quickly and easily See last page for details on $10 eBook version Robert Lair SOURCE CODE ONLINE www.apress.com US$ 39.99 Lair ISBN 978-1-4302-2988-9 39 9 Shelve in: Web Development/General User level: Beginning–Intermediate 781430 229889 www.it-ebooks.info this print for content only—size & color not accurate spine = 0.78125" 416 page count www.it-ebooks.info Beginning Silverlight in C# ■■■ Robert Lair www.it-ebooks.info Beginning Silverlight in C# Copyright © 2010 by Robert Lair 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-2988-9 ISBN-13 (electronic): 978-1-4302-2989-6 Printed and bound in the United States of America 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: Ewan Buckingham Technical Reviewer: Fabio Claudio Ferracchiati 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: Debra Kelly Copy Editor: Katie Stence Production Support: Patrick Cunningham 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@springer-sbm.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 www.it-ebooks.info In the memory of my Grandpa, James Wiles www.it-ebooks.info Contents at a Glance About the Author xv About the Technical Reviewer xvi Acknowledgments xvii Introduction xviii ■Chapter 1: Welcome to Silverlight ■Chapter 2: Introduction to Visual Studio 2010 13 ■Chapter 3: Layout Management in Silverlight 29 ■Chapter 4: Silverlight Controls 59 ■Chapter 5: Data Binding and Silverlight List Controls 87 ■Chapter 6: Silverlight Toolkit 123 ■Chapter 7: Data Access and Networking 149 ■Chapter 8: Navigation Framework 165 ■Chapter 9: Isolated Storage in Silverlight 193 ■Chapter 10: System Integration and Device Support 223 ■Chapter 11: Introduction to Expression Blend 245 ■Chapter 12: Styling in Silverlight 263 ■Chapter 13: Transformations and Animation 297 ■Chapter 14: Custom Controls 321 iv www.it-ebooks.info ■ CONTENTS AT A GLANCE ■Chapter 15: Printing in Silverlight 343 ■Chapter 16: Deployment 359 Index 375 v www.it-ebooks.info Contents About the Author xv About the Technical Reviewer xvi Acknowledgments xvii Introduction xviii ■Chapter 1: Welcome to Silverlight The Evolution of the User Interface Rich Internet Application Solutions What Is Silverlight? Benefits of Silverlight Cross-Platform/Cross-Browser Support Cross-Platform Version of the NET Framework Use of Familiar Technologies Small Runtime and Simple Deployment The Silverlight Development Environment New Features in Silverlight 10 Improved Performance 11 Summary 11 vi www.it-ebooks.info ■ CONTENTS ■Chapter 2: Introduction to Visual Studio 2010 13 What Is Visual Studio? 13 What’s New in Visual Studio 2010? 14 Support for Multiple Monitors 14 Zoom Support for Source Editor 15 Extension Manager 21 Building Your First Silverlight Application in Visual Studio 22 Try It Out: Hello World in Silverlight 22 Hosting Your Silverlight Application: Web Site or Web Application? 26 Summary 28 ■Chapter 3: Layout Management in Silverlight 29 Layout Management 29 The Canvas Panel 30 Try It Out: Using the Canvas Panel 31 Filling the Entire Browser Window with Your Application 35 The StackPanel Control 36 Try It Out: Using the StackPanel Control 36 Try It Out: Nesting StackPanel Controls 39 The Grid Control 41 Try It Out: Using the Grid Control 42 Try It Out: Nesting a Grid and Spanning a Column 46 The WrapPanel Control 50 Try It Out: Using the WrapPanel Control 51 The DockPanel Control 55 Try It Out: Using the DockPanel Control 55 Summary 58 vii www.it-ebooks.info ■ CONTENTS ■Chapter 4: Silverlight Controls 59 Setting Control Properties 59 Attribute Syntax 59 Element Syntax 60 Type-Converter-Enabled Attributes 60 Attached Properties 60 Nesting Controls Within Controls 61 Handling Events in Silverlight 62 Try It Out: Declaring an Event in XAML 63 Try It Out: Declaring an Event Handler in Managed Code 67 The Border Control 71 User Input Controls 75 Try It Out: Working with the TextBox Control 75 Try It Out: Working with the RadioButton and CheckBox Controls 79 Extended Controls 82 Adding an Extended Control 82 Try It Out: Using the GridSplitter 83 Summary 86 ■Chapter 5: Data Binding and Silverlight List Controls 87 Data Binding 87 The Binding Class 88 Try It Out: Simple Data Binding in Silverlight 88 Element to Element Binding 97 Try It Out: Element to Element Binding 97 The DataGrid Control 99 Try It Out: Building a Simple DataGrid 100 The Columns Collection 105 Try It Out: Building a DataGrid with Custom Columns 108 viii www.it-ebooks.info ■ INDEX handling in Silverlight Drop event, 240 declaring event handler in managed code, 67–71 Drop Target, 11 DropEventArgs.Data property, 240 declaring event in XAML, 63–66 DropMe.txt file, 242 dropping files, on Silverlight applications, 240–243 overview, 62 PrintDocument, 343 Expander control, 124 dynamic data, binding DataGrid and ListBox to, 102 experimental quality band, 125 dynamic link libraries (DLLs), 82 Expression Blend creating animation with, 304–312 key features of ■E overview, 245–246 element syntax, 60 split-view mode, 246 element to element binding, 97–99 template editing support, 247 elevated trust applications, 371–374 timeline, 247–248 elevated trust consent dialog box, 373–374 Visual State Manager (VSM), 247 Ellipse control, 61, 75 Visual Studio 2010 integration, 246 EndPrint events, 343, 354–357 visual XAML editor, 246 EndPrintEventArgs class, 343 working with projects in, 248–252 Error property, 343 laying out applications with ErrorWindow.xaml page, 187 Grid control, 255 events grid layout mode, 256–262 BeginPrint, 354–357 overview, 255 Drop, 240 overview, 245, 303 EndPrint, 354–357 setting inline properties with, 271–280 handling custom controls, 334–339 using to transform Silverlight objects, 315–319 declaring in managed code, 67–71 viewing storyboards in, 304 381 www.it-ebooks.info ■ INDEX Silverlight 4, 10–11 workspace Objects and Timeline panel, 255 Uri Mapping, 183–185 overview, 252 in Visual Studio 2010 Project panel, 254 Add References performance, 17 Properties panel, 254 box selection, 19 Toolbox, 252 Call Hierarchy window, 20 code generation, 21 extended controls adding, 82–83 Extension Manager, 21 GridSplitter, 83–85 improved IntelliSense, 16–17 overview, 82 reference highlighting, 18 support for multiple monitors, 14 Extensible Application Markup Language See XAML zoom support for source editors, 15– 21 Extension Manager, 21 file explorer, for isolated storage application layout, 197–207 ■F coding, 207–216 FallBackValue extension, data binding, 120 overview, 196 features testing, 216–217 application Library Caching, 360–361 COM interoperability, 235–239 File Modified dialog box, Expression Blend, 252 full screen pinning, 364 files Navigation Framework See Navigation Framework feature dropping on Silverlight applications, 240–243 out of browser support XAP, 359 customizing install application dialog, 367–368 Fill property, 232 out of browser API, 369 FontWeight property, 344 overview, 365–366 foreach statement, 241, 352 removing installed applications, 370–371 form controls FirePropertyChanged method, 94 Border control, 71–74 extended controls 382 www.it-ebooks.info ■ INDEX adding, 82–83 ■G GridSplitter, 83–85 generic.xaml file, 330–331 overview, 82 get operation, 94 handling events in Silverlight GetChildElement( ) method, 334 declaring event handler in managed code, 67–71 declaring event in XAML, 63–66 overview, 62 nesting controls within controls, 61–62 overview, 59 GetData method, 241 GetDirectoryNames( ) method, 194, 210 GetFileNames( ) method, 194, 211 GetHands( ) method, 151, 155–156 GetHandsAsync( ) method, 158, 160 GetHandsCompleted event handler, 160 setting control properties GetStorageData( ) method, 207, 210, 213, 216, 221 attached properties, 60 attribute syntax, 59 GetUserStoreForApplication( ) method, 194, 208 element syntax, 60 GlobalCalendar control, 125 overview, 59 type-converter-enabled attributes, 60 GoToState( ) method, 330, 335, 338 element, 162 user input controls Grid cells, 71, 166, 171 overview, 75 Grid components, 30 RadioButton and CheckBox controls, 79–82 Grid control TextBox control, 75–79 FormLabel style, 281 Frame control, 171, 173 Frame objects, 165–176 Frames, using multiple, 190–192 FrameworkElement object, 330 full screen pinning feature, 364 FullScreenOptions property, 365 Expression Blend, 255 nesting, 46–50 overview, 41 using, 42–45 Grid definition, 166 Grid element, 31, 36, 39 Grid layout control, 255 grid layout mode, Expression Blend, 255– 262 Grid panels, 42, 46 383 www.it-ebooks.info ■ INDEX hosting Grid.Column property, 41, 46 Grid.ColumnDefinitions property, 43 Silverlight content, 359–360 element, 256 in Visual Studio 2010, 26–28 HyperlinkButton control, 166–167, 173 Grid.ColumnSpan property, 49 GridPanel application, 42 GridPanel project, 46 Grid.Row property, 41, 46 ■I Grid.RowDefinitions property, 43 IDataObject, 241 GridSplitter class, 83–85, 198 IDE (integrated development environment ), GridSplitter control, 83–85, 124 implicit styles, 294 Grouping property, 81 ImplicitStyleManager control, 124 IncreaseQuotaTo( ) method, 220–221 InitializeComponent( ) method, 25 ■H HasElevatedPermissions property, 238 Header property, DataGridColumn, 106 HeaderedContentControl control, 124 HeaderedItemsControl control, 124 inline properties overview, 263 setting with Expression Blend, 271–280 setting with Visual Studio, 263–270 Inner View button, 182 Height attribute, 35 Height property, 31–32, 35, 40, 43, 59, 278, 298, 300 innerGrid object, 259 InnerView1.xaml file, 177–184 Hello World application, 22–26 INotifyPropertyChanged interface, 91–92 HelloWorld.Web project, 23–24 Install Application dialog box, customizing, 367–368 highlighting reference, 18 installing Toolkit, 125–126 Home.xaml page, 187 HorizontalAlignment property, 29, 38–39, 274 HorizontalContentAlignment property, 171 HorizontalScrollBarVisibility property, 206 integrated development environment (IDE), IntelliSense, 16–17 InTheRoot.txt file, 217 InvokeNotepad application, 236–239 ISBN property, 95 384 www.it-ebooks.info ■ INDEX isCoolDown flag, 337 ■K isolated storage Key attribute, 280 clearing, 218–219 keyframe animation, 299 file explorer KeySpline property, 309–310 application layout, 197–207 coding, 207–216 overview, 196 ■L testing, 216–217 Label control, 124 increasing quota, 219–222 LastChildFill property, 57 IsolatedStorageFile class, 194 layout management in Silverlight IsolatedStorageFileStream class, 194 Canvas panel filling browser windows with applications, 35–36 IsolatedStorageSettings class, 195–196 overview, 193–194 overview, 30 viewing, 218–219 using, 31–33 IsolatedStorageFile class, 194 DockPanel control, 55 IsolatedStorageFileStream class, 194 IsolatedStorageSettings class, 195–196 Grid control nesting, 46 IsReadOnly property, DataGridColumn, 106 overview, 41 using, 42–45 IsRunningOutOfBrowser property, 369 IsTextCompletionEnabled property, 133 overview, 29 Items.Clear( ) method, 210 StackPanel control ItemsSource property, 132 nesting, 39–41 ItemTemplate, 131 using, 36–38 WrapPanel control, 50–52 LayoutRoot element, 352 ■J LayoutRoot Grid, 223, 225, 236 JournalOwnership property, 190 LayoutRoot_Drop event, 241 JSON (JavaScript Object Notation), 150 LayoutTransformer control, 124 lblCurrentDirectory TextBlock, 201 385 www.it-ebooks.info ■ INDEX linear interpolation animation, 299 ■M LinkClick event handler, 167, 173 Mackey, Alex, 13 linking deep, 175–176 MainPage.xaml file, 14, 31, 46, 55, 139, 185, 191, 250, 256, 344 list controls MainPage.xaml.cs file, 25, 129, 144, 146, 227, 231, 236, 240, 348, 355 data binding, element to element binding, 97–99 managed code, declaring event handler in, 67–71 DataGrid control building simple, 100, 105 MappedUri attribute, 184 building with custom columns, 108, 113 Margin property, 38, 40, 60, 100, 171, 270 Mature/SDK quality band, 123 Columns collection, 105, 108 MaxWidth property, DataGridColumn, 106 overview, 99 microphones, accessing, 229–234 ListBox control building with custom content, 116, 118 Microsoft Silverlight Configuration window, 218 MinWidth property, DataGridColumn, 106 custom, 114–115 Modal Child Window, Silverlight 3, 137 default, 114–115 modal windows, 137–148 overview, 114 ModalWindow application, 139, 142 overview, 87 monitors, multiple, Visual Studio 2010 support for, 14 List generic class, 102 ListBox class, 201–202 Mono project, ListBox control Moonlight project, building with custom content, 116–118 custom, 114–115 MouseOver state, 325 multiple Frames, using, 190–192 default, 114–115 MyControl property, 324 overview, 114 Loaded event, 90, 102, 130, 160, 346 LoadFilesAndDirs( ) method, 207–208, 210 localized storage See isolated storage lstDirectoryListing directory, 201 ■N Name property, 324, 346 NameProperty object, 324 386 www.it-ebooks.info ■ INDEX NavAppFromScratch project, 166, 177, 179, 183, 190 Navigate method, 173, 180 NormalStates state group, 325 notification API, 223–228 NotificationWindow class, 227 Navigate to Event Handler option, 173, 205 Navigate to Inner View button control, 178 NotifyApplication project, Silverlight, 223, 228 Navigation Framework feature NotifyApplication.Web application, 223 benefits of, 175–176 NotifyWindow control, 227 Frame and Page objects, 165–176 NotifyWindow.xaml file, 224 NavigationService object, 176–179 NumericUpDown control, 124 passing data to navigation pages, 179– 183 Silverlight Navigation Application template, 186–190 ■O Object property, 299 Uri Mapping feature, 183–185 ObjectAnimation type, 299 using multiple Frames, 190–192 navigation pages, passing data to, 179–183 NavigationService object, 176–179 Objects and Timeline panel, 255, 304 Objects panel, 284 ObservableCollection class, 102 NavTemplate project, 186 OnApplyTemplate( ) method, 334–335 NavTemplate.Web application, 187 OnCaptureStarted callback, 235 nested grid properties, 259 OnCaptureStopped callback, 235 NestedStackPanel application, 39 OnCoolDownButtonChange( ) method, 338 nesting controls within controls, 61–62 Grid control, 46 onCoolDownSecondsPropertyChanged( ) method, 329 StackPanel control, 39–41 OneTime binding setting, 95 NET Framework, cross-platform version of, OneWay binding setting, 95 NET tab, Add References dialog box, 168 OnSample callback, 235 New Project dialog box, 166, 186 OnSendCompleted event handler, 163 New Silverlight Application dialog box, 23– 24, 166 OpenFile( ) method, 215–216 Normal state, 325 OnFormatChange callback, 235 Orientation property, 37, 39, 54, 277 387 www.it-ebooks.info ■ INDEX Phone property, Contact class, 346 out of browser support feature customizing install application dialog, 367–368 out of browser API, 369 Point property, 299 PointAnimation type, 299 Pressed state, 325 overview, 365–366 pressedTime member, 330 removing installed applications, 370– 371 Out-Of-Browser Settings button, 237, 367 Out-Of-Browser Settings dialog box, 368 Preview quality band, 124 Print As-Is button, SimplePrinting application, 350 Print dialog box, 350, 353 Print Formatted button, 353, 356 Print method, 343 ■P Print( ) method, 349 Page class, 25 Print method, 351 Page Loaded event, 113, 118 PrintAsIs delegate, 345, 348 Page objects, 165–176 PrintDocument class, 343, 351 Page_Loaded event handler, 160 PrintDocument events, 343 pages, navigation, 179–183 PageVisual property, 343, 349, 351–352 Page.xaml file, 160 PrintDocument object, 348 PrintFormatted delegate, 345, 351 PrintFormatted event, 355 panels, Canvas printing filling browser windows with applications, 35–36 API overview, 30 determining content, 343 using, 31–33 PrintDocument events, 343 simple printing, 343–350 Parts and States model, 321–323 passing data, to navigation pages, 179–183 custom content, 351–353 Path.Combine( ) method, 210 customization of, 354–357 Pause( ) method, 301–302 PrintPage event, 343, 349, 351–352 Paused property, 302 PrintPageEventArgs class, 349 performance, 11 PrintPageEventArgs.PageVisual property, 343 Person class, 21 ProductID property, 179 388 www.it-ebooks.info ■ INDEX Project panel, Expression Blend, 254 projects, Visual Studio web application, 27–28 REST (representational state transfer) services, 150 Resume( ) method, 301–302 properties, custom control, 327–330 RIA (Rich Internet Applications), 1, 3–4 Properties panel, Expression Blend, 254 RotateTransform type, 314 Property attribute, 280 Row property, 276 PropertyChanged event, 93 RowDefinition Collection Editor, 260–261 pseudo-conversational environments, 149 RowDefinition element, 46 RowDefinitions property, 260 Run at startup check box, Expression Blend, 248 ■Q Run command, 236 quality bands runtime, of Silverlight 4, 7–8 experimental, 125 Mature/SDK, 123 Preview, 124 ■S Stable, 124 Safari browsers, 10 Quota property, 212 SampleTextFile.txt, 217 ScaleTransform type, 313 ScaleX property, 313 ■R RadioButton control, 75, 79–82 ScaleY property, 313 Rating control, 125 security restrictions, 149 ReadToEnd( ) method, StreamReader, 215 Seek( ) method, 301 Rectangle control, 59, 75, 123, 225, 232 SendAsync( ) method, 163 RedButton style, 293 set operation, 94 RedButtonBigFont style, 293 Setter elements, 280, 285 reference highlighting, 18 Show( ) method, 138, 144 References folder, 167 ShowFile( ) method, 216 RenderTransformOrigin property, 314 ShowGridLines property, 43, 166, 261 RequestDeviceAccess method, 229 389 www.it-ebooks.info ■ INDEX Silverlight Runtime, 82 Silverlight Silverlight Toolkit benefits of controls cross-platform version of NET Framework, Accordion, 126–132 cross-platform/cross-browser support, AutoCompleteBox, 132–134 overview, 126–127 familiar technologies, TabControl, 134 overview, ViewBox, 135–137 small runtime and simple deployment, 7–8 experimental quality band, 125 development environment, installing, 125–126 evolution of user interfaces, 1–3 Mature/SDK quality band, 123 new features in, 10–11 modal windows, 137–148 rich Internet application (RIA) solutions, Preview quality band, 124 Stable quality band, 124 Silverlight applications Silverlight User Control option, 224 building in Visual Studio Hello World in Silverlight 4, 22–26 hosting, 26–28 using web application project, 27–28 using web site, 27 SilverlightDropTarget application, 240 SimplePrinting application, 344–345, 348 SimplePrinting project, 351, 354 SimplePrinting.Web application, 344 SkewTransform type, 314 content, hosting, 359–360 skinning, 247 creating navigation, 166 sn.exe utility, 364 data access in, 149–150 sockets deploying, 359–360 data access through, 162–164 dropping files on, 240–243 support, 149 Silverlight Child Window option, 142 source editors, zoom support for, 15–21 Silverlight Class Library template, 325 source variable, 231 Silverlight Navigation Application template, 186–190 splines, 298 Silverlight Page template, 171, 177, 190 split-view mode, 246 Silverlight property system, 323 Stable quality band, 124 390 www.it-ebooks.info ■ INDEX styles StackPanel class, 199, 202, 204, 352 defining at application level, 289–290 StackPanel controls nesting, 39–41 hierarchy of, 292–293 overview, 36 implicit, 294 using, 36–38 inheriting using BasedOn, 293–294 StackPanel layout control, 271 overview, 280–281 Start Capture button, 233 using as static resources, 281–289 styling StartCapture delegate, 232 with inline properties StartingHands.cs class, 151–152, 155 StartingHandService class, 160 overview, 263 StartingHandServiceClient object, 157 setting with Expression Blend, 271– 280 StartingHandServiceReference namespace, 156 setting with Visual Studio, 263–270 StartingHandService.svc.cs file, 154 overview, 263 StartingHands.GetHands( ) method, 153 with styles defining at application level, 289– 290 state groups, 322–323 states, custom control, 327–330 hierarchy of, 292–293 static resources, using styles as, 281–289 implicit styles, 294 Stop Capture button, 234 inheriting using BasedOn, 293–294 Stop( ) method, 233, 301–302 overview, 280–281 storyboards using as static resources, 281–289 overview, 298–299 support, cross-platform/cross-browser, viewing in Expression Blend, 304 system integration StreamReader class, 241 accessing webcams and microphones, 229–234 streams, captured, 235 StreamWriter class, 216 COM interoperability feature, 235–239 string formating, data binding and, 118 element, 280, 332 dropping files on Silverlight applications, 240–243 notification (toast) API, 223–228 391 www.it-ebooks.info ■ INDEX overview, 223 tag, 50 working with captured streams, 235 technologies, used in Silverlight 4, templates System.IO namespace, 240 System.IO.IsolatedStorage namespace, 194 editing support, Expression Blend, 247 System.IO.Path.Combine( ) method, 210, 214 Silverlight Navigation Application, 186– 190 testing custom controls, 339–341 System.IO.Path.GetDirectoryName( ) method, 213 Text property, 25, 181, 241, 277, 344 System.Net.Sockets.Socket object, 162 System.Runtime.InteropServices.Automati on, 236 System.Windows assembly, 83 TextBlock control, 25, 61, 123, 177, 180– 181, 190, 225, 240, 332 TextBlock labels, 266 System.Windows.Controls assembly, 83 TextBox controls, 59, 75–79, 88, 267, 287, 321 System.Windows.Controls namespace, 82 TextBoxStyle control, 284 System.Windows.Controls.Data assembly, 82–83, 360 TextBoxStyle property, 287 System.Windows.Controls.Navigation namespace, 167–168, 170 TextBoxStyle style, 292 TextWrapping property, 240, 275 themes folder, 330–331 System.Windows.Media.Animation namespace, 299 Timeline class, 299 System.Windows.Printing namespace, 348 timeline, Expression Blend, 247–248, 298 Timeline panel, 284 TimePicker control, 125 ■T TimeUpDown control, 125 TabControl control, 124, 134 Title property, 95 TabItem tags, 134 toast API, 223–228 TargetName property, 300 Toast Window Support, 11 TargetNullValue extension, data binding, 120 Toolbox TargetProperty property, 301 targets, Binding class, 87–88 TargetType attribute, 280 TargetType object, 332 Expression Blend, 252 Visual Studio, 127 Toolkit See Silverlight Toolkit Top Left button, 44 392 www.it-ebooks.info ■ INDEX user input controls Top Right button, 44 overview, 75 transformations RadioButton and CheckBox controls, 79–82 Expression Blend, 315–319 overview, 312 TextBox control, 75–79 types of user interfaces (UIs), evolution of, 1–3 overview, 313 UserControl definition, 82, 170, 324, 340 RotateTransform, 314 element, 284, 289 ScaleTransform, 313 SkewTransform, 314 using System.Windows.Printing statement, 348 TranslateTransform, 314–315 TransitioningContentControl, 125 transitions, 323 TranslateTransform type, 314–315 ■V TreeMap control, 125 Value attribute, 280 TreeView control, 124 VerticalAlignment property, 29, 39, 274 TryIncreaseQuotaTo( ) method, 219 VerticalContentAlignment property, 171 TwoWay binding setting, 95 VerticalScrollBarVisibility property, 206 txtFileName TextBox, 204 VideoBrush, 232 type-converter-enabled attributes, 60 VideoCaptureDevice, 232 VideoSink class, 235 View HyperlinkButton control, 174 ■U View link, 185 UI elements, 87–88 View link, 175 UIElement, 343 View1.xaml file, 171–172, 174, 177, 179– 180, 183–184 UIs (user interfaces), evolution of, 1–3 Uri attribute, 184 Viewbox control, 124 Uri Mapping feature, 183–185 ViewBox control, 135–137 UriMapper property, 185 UriMapper section, xml namespace, 183 UriMapping element, 184 View2.xaml file, 172, 183–184 Views directory, 186 Views folder, 187 Visibility property, DataGridColumn, 106 393 www.it-ebooks.info ■ INDEX Visual State Manager (VSM), 247, 322 ■W Visual Studio 2010 WCF (Windows Communication Foundation), 14, 150–161 building Silverlight applications in Hello World in Silverlight 4, 22–26 hosting, 26–28 Web Application project, Visual Studio, 27–28, 128 web service proxy class, 160 using application project, 27–28 using site, 27 web services, data access through, 150–161 web site, Visual Studio, 27 new features webcams, accessing, 229–234 Add References performance, 17 box selection, 19 Web.config file, 25 Width attribute, 35 Call Hierarchy window, 20 code generation, 21 Width property, 31, 35, 43, 59, 106, 288, 298, 300–301 Extension Manager, 21 windows improved IntelliSense, 16–17 Call Hierarchy, 20 reference highlighting, 18 modal, 137–148 support for multiple monitors, 14 zoom support for source editors, 15– 21 opening Object Browser, 157 Windows Presentation Foundation (WPF), Windows Presentation Foundation Everywhere (WPF/E), overview, 13 setting inline properties with, 263–270 Visual Studio toolbox, 127 workspace, Expression Blend Objects and Timeline panel, 255 visual XAML editor, 246 overview, 252 VisualStateManager.GoToState( ) method, 330 VSM (Visual State Manager), 247, 322 Windows Communication Foundation (WCF), 14, 150–161 Project panel, 254 Properties panel, 254 Toolbox, 252 WPF (Windows Presentation Foundation), WPF/E (Windows Presentation Foundation Everywhere), 394 www.it-ebooks.info ■ INDEX WrapPanel application, 51 XAP files, 82, 359 WrapPanel control, 29–30, 50–52, 56, 124 XML element, attribute syntax and, 59 Write( ) method, StreamWriter class, 216 xml namespace, 183 WScript.Shell object, 236 xmlns attribute, 56 WYSIWYG editor, XAML, 246 xmlns declaration, 82 ■X ■Y X property, 314 Y property, 314 XAML (Extensible Application Markup Language) declaring event in, 63–66 markup extensions, 88, 91 setting Columns collection in, 105 ■Z zoom, Visual Studio 2010 support for, 15– 21 XamlParseException class, 202 395 www.it-ebooks.info ... 3 24 Try It Out: Building a Custom Control 3 24 Summary 341 ■Chapter 15: Printing in Silverlight 343 The Printing API 343 Try It Out: Implementing...www.it-ebooks.info Beginning Silverlight in C# ■■■ Robert Lair www.it-ebooks.info Beginning Silverlight in C# Copyright © 2010 by Robert Lair All rights reserved... Simple Printing 343 Printing Custom Content 351 Try It Out: Implementing a Custom Print 351 Additional Printing Customization 3 54 Try It Out: Handling

Ngày đăng: 12/03/2019, 11:47

w