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

Apress pro WPF with VB 2008 windows presentation foundation with dot NET 3 5 mar 2008 ISBN 1590599624 pdf

1.1K 167 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

 CYAN   MAGENTA  YELLOW   BLACK  PANTONE 123 C Books for professionals by professionals ® The EXPERT’s VOIce ® in NET Companion eBook Available Pro WPF with VB 2008: Windows Presentation Foundation with NET 3.5 Dear Reader, Pro WPF in C# 2008: Windows Presentation Foundation with NET 3.5 Pro NET 2.0 Windows Forms and Custom Controls in VB 2005 The Book of Visual Basic 2005 Coauthor of Pro ASP.NET 3.5 in C# 2008 (with Mario Szpuszta) Welcome aboard! Matthew MacDonald (Microsoft MVP, MCSD) Companion eBook THE APRESS ROADMAP Beginning VB 2008 See last page for details on $10 eBook version SOURCE CODE ONLINE www.apress.com Accelerated VB 2008 Beginning VB 2008 Databases Pro VB 2008 and the NET 3.5 Platform, Third Edition Beginning ASP.NET 3.5 in VB 2008 Visual Basic 2008 Recipes Pro WPF with VB 2008 WPF with VB 2008 Author of For years, NET developers have created Windows applications with the Windows Forms toolkit And though Windows Forms is mature and reasonably full-featured, it’s hardwired to essential bits of Windows plumbing that haven’t changed much in the past ten years As a result, some tasks that should be easy require a lot of work The Windows Presentation Foundation (WPF) changes all this by introducing a new model with entirely different plumbing Although WPF includes the standard controls you’re familiar with, it draws every detail itself, using the high-performance DirectX engine As a result, WPF can provide a whole host of eye-popping new features, all of which we’ll cover in this book For example, we’ll give common controls like buttons a slick, customized look without writing a line of code Similarly, we will craft animated effects that rotate, stretch, scale, and skew anything in your user interface right before the user’s eyes Tasks that would have been difficult or nearly impossible in Windows Forms—such as playing media files or creating texture-mapped 3-D shapes—are finally possible By the time you’ve finished this book, you’ll have mastered these previously tough tasks Although WPF’s video, animation, and 3-D features get the most hype, WPF is just as useful for building business applications that don’t need rich graphics We’ll cover WPF’s enhancements of key business features such as data binding, print management, and document display, giving you all you need to create professional business applications in WPF Pro ISBN-13: 978-1-59059-962-4 ISBN-10: 1-59059-962-4 55499 US $54.99 Pro WPF with VB 2008 Windows Presentation Foundation with NET 3.5 Create the next generation of Windows applications Matthew MacDonald MacDonald Shelve in Programming/Microsoft/.NET User level: Intermediate–Advanced 781590 599624 this print for content only—size & color not accurate spine = 2.035" 1,088 page count 962-4 FM.qxd 3/6/08 10:54 AM Page i Pro WPF with VB 2008 Windows Presentation Foundation with NET 3.5 Matthew MacDonald 962-4 FM.qxd 3/6/08 10:54 AM Page ii Pro WPF with VB 2008: Windows Presentation Foundation with NET 3.5 Copyright © 2008 by Matthew MacDonald 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-59059-962-4 ISBN-10 (pbk): 1-59059- 962-4 ISBN-13 (electronic): 978-1-4302-0590-6 ISBN-10 (electronic): 1-4302-0590-3 Printed and bound in the United States of America Trademarked names may appear in this book Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark Lead Editor: Matt Moodie Technical Reviewer: Christophe Nasarre Editorial Board: Clay Andres, Steve Anglin, Ewan Buckingham, Tony Campbell, Gary Cornell, Jonathan Gennick, Kevin Goff, Matthew Moodie, Joseph Ottinger, Jeffrey Pepper, Frank Pohlmann, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh Project Manager: Sofia Marchant Copy Editor: Kim Wimpsett Associate Production Director: Kari Brooks-Copony Production Editor: Laura Esterman Compositor: Gina Rexrode Proofreader: Liz Welch Indexer: Broccoli Information Management Artists: Diana Van Winkle, April Milne Cover Designer: Kurt Krames Manufacturing Director: Tom Debolski Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013 Phone 1-800-SPRINGER, fax 201-348-4505, e-mail orders-ny@springer-sbm.com, or visit http://www.springeronline.com For information on translations, please contact Apress directly at 2855 Telegraph Avenue, Suite 600, Berkeley, CA 94705 Phone 510-549-5930, fax 510-549-5939, e-mail info@apress.com, or visit http://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 http://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 http://www.apress.com 962-4 FM.qxd 3/6/08 10:54 AM Page iii For my wonderful family, Faria and Maya 962-4 FM.qxd 3/6/08 10:54 AM Page iv Contents at a Glance About the Author xxiii About the Technical Reviewer xxv Acknowledgments xxvii Introduction xxix ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER iv 10 11 12 13 14 15 16 17 18 19 20 21 22 23 Introducing WPF XAML 23 The Application 59 Layout 77 Content 119 Dependency Properties and Routed Events 139 Classic Controls 183 Windows 219 Pages and Navigation 249 Commands 293 Resources 321 Styles 353 Shapes, Transforms, and Brushes 371 Geometries, Drawings, and Visuals 417 Control Templates 453 Data Binding 499 Data Templates, Data Views, and Data Providers 561 Lists, Trees, Toolbars, and Menus 609 Documents 655 Printing 709 Animation 741 Sound and Video 795 3-D Drawing 821 962-4 FM.qxd 3/6/08 10:54 AM ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER 24 25 26 27 Page v Custom Elements 867 Interacting with Windows Forms 917 Multithreading and Add-Ins 941 ClickOnce Deployment 979 ■INDEX 997 v 962-4 FM.qxd 3/6/08 10:54 AM Page vi 962-4 FM.qxd 3/6/08 10:54 AM Page vii Contents About the Author xxiii About the Technical Reviewer xxv Acknowledgments xxvii Introduction xxix ■CHAPTER Introducing WPF .1 Understanding Windows Graphics DirectX: The New Graphics Engine Hardware Acceleration and WPF WPF: A Higher-Level API Resolution Independence The Evolution of WPF 11 Windows Forms Lives On 14 DirectX Also Lives On 15 Silverlight 15 The Architecture of WPF 16 The Class Hierarchy 18 The Last Word 21 ■CHAPTER XAML 23 Understanding XAML 24 Graphical User Interfaces Before WPF 24 The Variants of XAML 26 XAML Compilation 26 XAML Basics 27 XAML Namespaces 28 The Code-Behind Class 29 Properties and Events in XAML 32 Simple Properties and Type Converters 33 Complex Properties 34 Markup Extensions 36 Attached Properties 37 Nesting Elements 39 vii 962-4 FM.qxd 3/6/08 viii ■CONTENTS 10:54 AM Page viii Special Characters and Whitespace 42 Events 43 The Full Eight Ball Example 46 Using Types from Other Namespaces 47 Loading and Compiling XAML 49 Code-Only 50 Code and Uncompiled XAML 52 Code and Compiled XAML 54 XAML Only 56 The Last Word 58 ■CHAPTER The Application 59 The Application Life Cycle 59 Creating an Application Object 59 Deriving a Custom Application Class 60 Application Shutdown 62 Application Events 63 Application Tasks 65 Handling Command-Line Arguments 65 Accessing the Current Application 66 Interacting Between Windows 67 Single-Instance Applications 69 The Last Word 75 ■CHAPTER Layout 77 Understanding Layout in WPF 77 The WPF Layout Philosophy 78 The Layout Process 79 The Layout Containers 79 Simple Layout with the StackPanel 81 Layout Properties 83 Alignment 84 Margin 85 Minimum, Maximum, and Explicit Sizes 86 The WrapPanel and DockPanel 89 The WrapPanel 89 The DockPanel 90 Nesting Layout Containers 92 962-4 Index.qxd 3/5/08 8:21 AM Page 1039 ■INDEX SoundPlayer class, 924 embedding sound files into compiled assembly as binary resource, 797 limitations of, 795 Load() method, 796 LoadAsync() method, 796 LoadCompleted event, 796 loading and playing sound asynchronously, 797 no queueing feature for playing multiple audio snippets, 797 Play() method, 796–797 PlayLooping() method, 796 PlaySync() method, 796–797 procedure for playing sound, 796 SoundLocation property, 796 Stream property, 796 WAV audio files, 795 SoundPlayerAction class, 796, 798 Sounds and Audio Devices icon, 799 Source property, 256, 481, 511, 596, 605, 798, 803 SourceItems property, 271 SourceName property, 805 Span.Tag property, 676 Speak() method, 817 special characters, 42 SpecularMaterial class, 844 SpecularPower property, 844 speech recognition, 818, 819 Speech Recognition Grammar Specification (SRGS), 819, 820 Speech Software Development Kit, Microsoft, 818 speech synthesis, 816 SpeechDetected event, 819 SpeechHypothesized event, 819 SpeechRecognitionRejected event, 819 SpeechRecognized event, 819 SpeechRecognizer class constructing SRGS grammar, 819 GrammarBuilder.Append() method, 820 retrieving text from SpeechRecognizedEventArgs.Result property, 819 SpeechDetected event, 819 SpeechHypothesized event, 819 SpeechRecognitionRejected event, 819 SpeechRecognized event, 819 SRGS one-of rule, 820 SubsetMatchingMode enumeration, 820 System.Speech.Recognition.SrgsGrammar namespace, 819 using GrammarBuilder class, 820 using SrgsDocument, 819 SpeechSynthesizer class, 817 SpeedRatio property, 808 Find it faster at http://superindex.apress.com/ supplying brush for Stroke or Fill property, 374 table of properties, 373 Transform class, 389 Transform object, 373 using Canvas to control shape placement and overlap, 377 using Viewbox element to resize shapes proportionally, 378 Shared attribute, 343 shared size groups, 103 SharedSizeGroup property, 105, 564 Short Date data type, 537 Show All Files icon, 960 Show() method, 222, 230 ShowDialog() method, 222, 229, 711 ShowDocument() method, 71 ShowGridLines property, 94 ShowsNavigationUI property, 254 ShowsPreview property, 101 Shutdown() method, 63 ShutdownMode property, 62 SignDigitally() method, 694 Silverlight 1.0, 15 Silverlight 2.0, 15, 291 Silverlight XAML, 26 SimpleStyles project, 496 SingleCriteriaHighlightTemplateSelector class, 573–574, 591 SingleInstanceApplicationWrapper class, 72 SingleInstanceApplicationWrapper.StartupN extInstance event, 74 single-thread affinity (STA), 19 Size property, 427, 717 SizeToContent property, 88, 134, 328 SkipToEditableCharacter() method, 896 Slider control, 975 IsSnapToTickEnabled property, 506 RangeBase class, table of properties, 216 SelectionEnd property, 216 SelectionStart property, 216 setting position selection range, 216 TickFrequency property, 506 Ticks collection, 216 uses for, 216 Slider controls, 871 Smoothness property, 412 snapshot-and-replace behavior, 763 SnapsToDevicePixels property, 389, 463, 578 Snoop utility, 458 SolidColorBrush, 184 Solution Explorer, 60, 63, 327 Sort property, 588 SortDescription objects, 589 SortDescriptions property, 596 Sound icon, 799 SoundLocation property, 796 1039 962-4 Index.qxd 1040 3/5/08 8:21 AM Page 1040 ■INDEX SpellCheck.IsEnabled property, 208 SpellingReform property, 209 spline key frames, 786 splitter bars, 99 SpotLight class, 831 SpreadMethod property, 397 square-drawing application, 443 SRGS (Speech Recognition Grammar Specification), 819, 820 SrgsDocument, 819 SSML (Synthesis Markup Language), 818 STA (single-thread affinity), 19 StackPanel, 92 arranging elements vertically or horizontally, 82 button stack example, 81 changing alignment defaults, 84 considerations when sizing button, 87 description of, 80 DesiredSize property, 87 Height property, 86 HorizontalAlignment property, 84 IScrollInfo and logical scrolling, 128 layout properties, table of, 83 Margin property, 85 setting control margins, 85 Thickness structure, 85 using in Visual Studio, 82 VerticalAlignment property, 84 Width property, 86 StartLineCap property, 385 StartPoint property, 396, 426 Startup event, 60 StartupNextInstance event, 71 StartupUri attribute, 927 StartupUri property, 61, 260 static resources, 339 StaticExtension, 37 StaticResource, 565 StaticResource reference, 467 StatusBar class arranging its children using horizontal StackPanel, 653 configuring proportionally-aligned or right-aligned items, 653 displaying text and image indicators, 652 functions and limitations of, 652 no support for draggable rearranging or overflow menu, 652 status bar, function of, 648 StatusBarItem object, 653 System.Windows.Controls.Primitives namespace, 653 StatusBarItem object, 653 StaysOpen property, 204, 287 StaysOpenOnClick property, 645 StickyNoteControl class, 707 stitching (z-fighting), 834 Stop() method, 802 StopLoading() method, 265 Store database, 515, 539 StoreDataSetPaginator class, 727, 732 StoreDB class binding to ADO.NET data objects, 530 binding to collection of objects, 524 building data object, 518 caller inform design pattern, 518 collection items, displaying and editing, 525 collection items, inserting and removing, 529 DataContent property, 528 DataContext property, 521 displaying bound object, 519 DisplayMemberPath property, 527 enabling database updates, 521 GetProduct() method, 516 GetProducts() method, 525 handling change notification, 522 IEnumerable interface, 524 INotifyCollectionChanged interface, 529 INotifyPropertyChanged interface, 523 ItemsControl class, table of properties, 524 making instance available through Application class, 517 OnPropertyChanged() method, 524 options for making it available to application windows, 516 preventing field from being edited, 528 Product object, 518 PropertyChanged event, 523 UpdateProduct() method, 521 Storyboard class BeginStoryboard action, 758 BeginStoryboard.HandoffBehavior property, 763 creating property trigger that triggers storyboard, 760 defining storyboard, 758 fusing second animation into first animation’s timeline, 763 HandoffBehavior.Compose, 763 managing simultaneous animations as one group, 764 SetSpeedRatio() method, 768 snapshot-and-replace behavior, 763 storyboard, defined, 757 TargetName property, 757–759 TargetProperty property, 757–759 Stream property, 324, 796 StreamResourceInfo object, 323 Stretch property, 123, 138, 376, 379, 401, 404, 812 StretchDirection property, 138, 379, 812 962-4 Index.qxd 3/5/08 8:21 AM Page 1041 ■INDEX pulling style out of Resources collection using FindResource(), 355 setters as only changing dependency property, 358 setting BasedOn attribute of style, 361 setting element’s Style property, 355 setting style programmatically, 355 setting TargetType property of Style object, 359 Style class, table of properties, 356 Style objects as wrapping collection of Setter objects, 358 support for triggers and templates, 353 using BasedOn property to create chain of inherited styles, 362 using resources to hold styles, 353 using Setter.TargetName property, 358 using styles and resources together, 357 using to set any dependency property, 353 wiring up events to event handlers, 360 StyleSelector class, 581 Style.Triggers collection, 364 stylus events, 166 SuppressExceptions property, 541 SweepDirection property, 429 SynchronizationContext class, 951 Synthesis Markup Language (SSML), 818 system DPI setting, 6–8, System.Add.dll assembly, 965 System.AddIn.Contract namespace, 961, 975 System.AddIn.Contract.dll assembly, 965 System.AddIn.dll assembly, 963 System.AddIn.Hosting namespace, 968 System.AddIn.Hosting.AddInStore class, 966 System.AddIn.Hosting.AddInToken class, 966 System.AddIn.Pipeline namespace, 962, 976 System.AddIns.Pipeline.ContractHandle object, 965 SystemBrushes class, 395 System.Collections.Generic namespace, 880 SystemColors class, 184 System.ComponentModel namespace, 892, 947 System.ComponentModel.Component class, 924 System.ComponentModel.MaskedTextProvider, 894 System.ComponentModel.PropertyGroupDescription, 591 System.ComponentModel.SortDescription, 589 System.Data namespace, 588 System.Drawing namespace, 345 System.Drawing.dll, 921, 925 System.Drawing.Graphics class, 241 SystemDropShadowChrome class, 414, 415, 461 Find it faster at http://superindex.apress.com/ Stroke objects, 109 Stroke property, 380 StrokeDashArray property, 387 StrokeDashCap, 388 StrokeDashOffset property, 388 StrokeLineJoin property, 386 StrokeMiterLimit, 386 Strokes collection, 109 Style class creating Style object, 357 table of properties, 356 TargetType property, 456 Style property, 355 style selectors applying alternate row highlighting, code example, 581 defined, 581 StyleSelector class, 581 styles, adding Setter objects, 355 advantages of, 343 applying different style formats to different element types, 359 applying only one Style object to element at once, 361 applying style-based event handlers, 360 attaching event handlers for MouseEnter and MouseLeave events, 360 automatically applying styles by type, 363 benefits of, 356 comparing event setters and event triggers, 360 comparing to CSS, 353 complications arising from automatic styles, 364 creating collection of EventSetter objects, 360 creating Style object, 357 creating style that builds upon another style, 361 creating System.Windows.Style object as resource, 355 defined, 353 defining style to wrap various font properties, 355 disadvantages of style inheritance, 363 example of standardizing font properties of window, 353 identifying property to be set, 358 linking triggers to styles through Style.Triggers collection, 364 naming convention, 355 not using styles and resources together, 357 omitting key name when setting TargetType property, 363 overriding style characteristics, 356 1041 962-4 Index.qxd 1042 3/5/08 8:21 AM Page 1042 ■INDEX System.Environment class, 239 System.Globalization.NumberStyles value, 538 System.IO.Compression namespace, 287 System.IO.DriveInfo class, 640 System.IO.FileSystemWatcher, 642 System.IO.IsolatedStorage namespace, 286 System.IO.Packaging namespace, 706 System.Linq.Enumerable class, 533 System.Media namespace, 795 SystemParameters class, 223 System.Printing namespace, 709, 733, 736 System.Printing.PrintQueue object, 732 System.Security.Principal.WindowsIdentity class, 700 SystemSounds class, 798, 799 System.Speech.dll assembly, 816 System.Speech.Recognition namespace, 819 System.Speech.Recognition.SrgsGrammar namespace, 819 System.Speech.Synthesis namespace, 817 System.Threading.DispatcherObject, 19 System.Threading.Thread, 942, 945 System.TimeSpan, 751 System.Windows namespace, 345 System.Windows.Annotations namespace, 696–697 System.Windows.Application class See Application class System.Windows.Clipboard class, 181 System.Windows.Controls namespace, 550, 707, 709, 822 System.Windows.Controls.ContentControl, 20 System.Windows.Controls.Control, 20, 119 System.Windows.Controls.Decorator, 135 System.Windows.Controls.ItemsControl, 20 System.Windows.Controls.Page class, 250 System.Windows.Controls.Panel, 20, 583 System.Windows.Controls.Primitives namespace, 197, 204, 462, 464, 653 System.Windows.Controls.Primitives.RangeB ase class, 888 System.Windows.Controls.Primitives.TextBox Base class, 894 System.Windows.Data.CollectionViewSource class, 585 System.Windows.Data.DataSourceProvider class, 602 System.Windows.DependencyObject, 19 System.Windows.Documents namespace, 659 System.Windows.Documents.TextRange class, 686 System.Windows.Forms.Application class, 59, 923 System.Windows.Forms.Control class, 930 System.Windows.Forms.dll, 921, 925 System.Windows.Forms.Integration namespace, 930 System.Windows.FrameworkElement, 19 System.Windows.Freezable class, 186 System.Windows.Input.Cursor, 193 System.Windows.Input.ICommand interface, 295 System.Windows.Input.RoutedCommand class, 296 System.Windows.Interop.HwndHost class, 939 System.Windows.LogicalTreeHelper, 456 System.Windows.Markup.MarkupExtension, 37 System.Windows.Media namespace, 799 System.Windows.Media.Animation namespace, 744–746, 771 System.Windows.Media.Brush, 395 System.Windows.Media.Color, 872 System.Windows.Media.DrawingContext, 869 System.Windows.Media.Effects namespace, 409 System.Windows.Media.Fonts class, 191 System.Windows.Media.Media3D namespace, 823 System.Windows.Media.Pen class, 435 System.Windows.Media.Transform class, 389 System.Windows.Media.Visual, 19, 709 System.Windows.Media.VisualTreeHelper, 456 System.Windows.MessageBox class, 230 System.Windows.Presentation.dll assembly, 976 System.Windows.Rect, 224 System.Windows.Shapes namespace, 124 System.Windows.Shapes.Shape class, 372 System.Windows.Threading namespace, 942 System.Windows.Threading.DispatcherTime r, 742 System.Windows.TriggerAction, 759 System.Windows.TriggerBase, 364 System.Windows.UIElement, 19 T TabControl, 130 TabIndex property, setting, 174 TabItem control, 121, 130 Table element CellSpacing property, 666 creating table, procedure and markup for, 665–666 sizing table columns explicitly or proportionately, 667 supplying TableColumn objects for Table.Rows property, 666 962-4 Index.qxd 3/5/08 8:21 AM Page 1043 ■INDEX AutoWordSelection, 208 BeginChange() method, 209 CanUndo property, 209 creating multiline text box, 206 EndChange() method, 209 IsReadOnly property, 207 Language property, 208 LineCount property, 207 pressing Enter key in, 207 SelectedText property, 208 selecting text, 207 SelectionChanged event, 208 SelectionLength property, 208 SelectionStart property, 208 setting HorizontalScrollBarVisibility property, 207 setting VerticalScrollBarVisibility property, 207 SpellCheck.IsEnabled property, 208 spelling-checker feature, 208 SpellingReform property, 209 Text property, 206 TextBox class, 207 TextChanged event, 170 TextWrapping property, 207 Undo feature, 209 using MinLines and MaxLines properties, 207 TextChanged event, 170 TextCompositionEventArgs object, 172 TextDecorations, 660 TextDecorations class, 189 TextDecorations property, 189 TextIndent property, 663 TextInput event, 170–172 TextMarkerStyle enumeration, 663 TextPointer objects, 688 TextRange class, 687–688 TextSearch.TextPath property, 614 TextSelection class, 690, 691 TextTrimming property, 680 texture mapping, 846 TextureCoordinates collection creating multifaceted cube, 848 markup for creating VisualBrush that loops video playback, 849 markup for mapping one face of cube, 847 using ImageBrush to paint bitmap, 846 using relative coordinates in, 848 TextureCoordinates property, 825–827 TextWrapping property, 207, 680 Thickness structure, 85 ThicknessAnimation class, 744, 774 this keyword, 494 thread affinity, 942 Thread object, 974 thread rental, 941 Find it faster at http://superindex.apress.com/ TableCell element, 665 TableRow element, 665 TableRowGroup element, 665 TableCell element, 666 TableLayoutPanel, 77, 933 TableRow element, 665 TableRowGroup element, 665 TabletPC, 81 TabPanel, 81 TabStripPlacement property, 130 Tag property, 492, 640 Target property, 194 TargetInvocationException, 553 TargetItems property, 271 TargetName property, 460, 471, 757–759 TargetProperty property, 757–759 TargetType attribute, 884 TargetType property, 359, 456, 628 TargetZone tag, 278 TaskDialog class, 245 TaskDialogResult object, 246 template selectors, 569 TemplateBinding, 885–886 TemplatedParent property, 494 TemplatePart attributes, 488 templates, attaching triggers with template, 761 building complex, multipart templates, 482 characteristics of complex templates, 482 combining template types in same control, 461 control template dependencies, 483 control templates, 461 data templates, 461 FrameworkTemplate class, 461 hiding or showing elements in response to trigger, 472 panel templates, 461 retrieving control’s template and serializing it to XAML, 463 reusing, 564 setting sequential order for conflicting trigger settings, 472 similarity between templates and styles, 473 template bindings, 468 types of, 461 text controls, 206 text handling, Text property, 41, 206, 297 TextAlignment property, 678 TextBlock element, 122 TextBox class, 33, 38, 41, 190, 207 TextBox control AcceptsReturn property, 207 AcceptsTab property, 207 1043 962-4 Index.qxd 1044 3/5/08 8:21 AM Page 1044 ■INDEX Thumb element, 462 TickBar element, 462, 910 TickFrequency property, 506 Ticks collection, 216 TileBrush, 187 TileMode property, 404, 438 TileView class adding set of properties to, 631 BasedOn property, 628 changes to, after selecting TileView style, 628 ComponentResourceKey, 627 ItemTemplate property, 626 markup for TileView style, 628 retrieving default styles using generic.xaml, 627 TargetType property, 628 TileView style, 626 TileViewItem style, 626 Time data types, 537 Timeline class AccelerationRatio property, 755 BeginTime property, 764 DecelerationRatio property, 755, 773 DesiredFrameRate attached property, 772 RepeatBehavior property, 756 SpeedRatio property, 764 table of properties, 755 TimelineGroup class, 754 timer-based animation, 742 Timestamp property, 169 Title property, 492 To property, 748, 750 ToggleButton class, 197 ToList() method, 533 ToolBar class adding items automatically to overflow menu, 650 changing behavior of ToggleButton, 649 components of, 648 configuring OverflowMode property, 650 holding image content in buttons, 650 lack of dedicated wrapper class, 650 overriding default style of some types of children, 649 setting Orientation property, 650 toolbar, function of, 648 ToolbarOverflowPanel, 81 ToolbarPanel, 81 ToolBarTray class, 651, 652 tools, 3–D modeling, 841 ToolTip, 119–121 ToolTip class, 199 ToolTip property, 199 Tooltips control configuring ToolTip-related settings, 200 CustomPopupPlacementCallback property, 202 inability of ToolTip window to accept focus, 200 options for placing tooltip, 201 Placement property, 201 PlacementTarget property, 202 ToolTip class, 199 ToolTip properties, table of, 200 ToolTipService class, 202 ToolTipService class, 203 Top property, 107, 224 top-level elements in XAML, 27 ToString() method, 121, 123, 172, 211, 215, 526 total-fit algorithm, 679 ToXml() method, 818 Track class, 486, 488 TrackballDecorator class, 857 Transform class, 389 Transform object, 713–714 Transform property, 442 Transform3DGroup class, 851 transforms animating element’s visual appearance, 775 animating multiple transforms, 778 approaches for creating dynamic 3-D effects, 851 assigning RenderTransform property to transform object, 391 comparing RenderTransform and LayoutTransform, 393, 777 creating databound Slider for rotating 3-D objects, 852 creating document window that jumps into view, 778 defined, 389 defining transform, 775 deriving from Freezable, 390 Expression Blend design tool, 780 Frame element, 394 LayoutTransform property, 393, 775 manipulating 3-D objects using, 850 Model3D class, 851 Model3DGroup class, 851 ModelVisual3D class, 851 naming transform objects using x:Name attribute, 851 nesting transforms inside TransformGroup, 778 RenderTransform property, 775 RenderTransformOrigin property, 393 RotateTransform class, 391, 774–775, 780 RotateTransform3D, 852, 865 rotating button on mouseover, 775 ScaleTransform, 774, 780 ScaleTransform3D, 851 setting RenderTransform property of Border object, 780 962-4 Index.qxd 3/5/08 8:22 AM Page 1045 ■INDEX triggers applying event triggers using FrameworkElement.Triggers collection, 364 attaching simple trigger to dependency property, 365 automating simple style changes, 364 Conditions collection, 367 considering trigger order when modifying elements, 366 creating multiple triggers that apply to same element, 366 event triggers, 367 linking triggers to styles through Style.Triggers collection, 364 performing animation when dependency property hits specific value, 368 returning to pre-trigger appearance of element, 365 setting sequential order for conflicting trigger settings, 472 setting Trigger.EnterActions and Trigger.ExitActions properties, 369 System.Windows.TriggerBase, classes deriving from, 364 TargetName property and, 460 using MultiTrigger, 367 waiting for button to get keyboard focus, 365 Triggers collection, 760 Trusted Publishers store, 284 TryFindResource() method, 344 TryParse() method, 538 tunneling events, 157, 164 type converters, 33, 34 TypeConverter attribute, 34 TypeExtension, 37 TypeNameAnimationBase class, 745 Typography object, 660 U UAC (User Account Control), 74, 983, 991 Uid attribute, 331 UIElement class, 17–19, 153, 440 AddHandler() method, 318 Arrange() method, 714 IsMouseDirectlyOver property, 177 IsMouseOver property, 177 Label, 122 Measure() method, 714 OnRender() method, 909 Opacity property, 186 TextBlock, 122 Visibility property, enumeration values, 116 UIElement3D class, 860 Find it faster at http://superindex.apress.com/ setting RenderTransformOrigin property, 776 setting shape’s center point, 393 Transform3DGroup class, 851 transforming any element, 393 TranslateTransform, 774 TranslateTransform3D class, 851 use of matrix math to alter shape coordinates, 390 WindowsFormsHost, 394 TranslateTransform, 774 TranslateTransform3D class, 851 transparency, 2, 186–188 TreeView class, 80, 612 TreeView control adding non-TreeViewItem elements to TreeView, 634 adding placeholder under each drive node, 640 applying data templates by data type instead of by position, 637 constructing TreeViewItem objects programmatically, 634 displaying CategoryName property of each Category object, 636 displaying folders on hard drive using just-in-time TreeView, 640 displaying non-UIElement object, 634 filling TreeView with data, 634 handling TreeViewItem.Expanded event, 641 HierarchicalDataTemplate, 637 implementing Category class and INotifyPropertyChanged, 635 incorporating hierarchical data with nested structure, 634 ItemsSource property, 637 ItemTemplate property, 637 just-in-time node creation, 639 markup for basic TreeView, 634 setting ItemsSource property, 634 as specialized ItemsControl that hosts TreeViewItem objects, 633 specifying right data templates for different levels of data, 635 System.IO.DriveInfo class, 640 System.IO.FileSystemWatcher, 642 TreeViewItem objects, 634 using name of DataRelation as ItemsSource, 639 using TreeView to show multilayered DataSet, 638 TreeViewItem, 640, 641 TriangleIndices property, 825–826, 836 Trigger.EnterActions, 760 Trigger.ExitActions, 760 1045 962-4 Index.qxd 1046 3/5/08 8:22 AM Page 1046 ■INDEX UIElement.AddHandler() method, 155 Undo command, 314 Undo feature, 209 UndoCommand_CanExecute() method, 881 UndoCommand_Executed() method, 881 UniformGrid, 80, 106 UnionIterator class, 533 UnmanagedMemoryStream object, 324 Unselected event, 214 Update() method, 966 UpdateProduct() method, 521 UpdateSourceTrigger property, 506, 510, 552 URI format, 29 URIs, 325, 326 Use Windows XP Style DPI Scaling, 9–11 User Account Control (UAC), 74, 983, 991 user controls adding command bindings, 879 adding command support to controls, 879 adding user control to custom control library project, 871 Color property, 872 ContentControl template, 882 control consumer, 872 control template, 882 creating basic color picker, 870 creating lookless control, 883 creating new RoutedUICommand object for command, 879 creating undo stack that stores series of values, 880 defining and adding routed events, 875 designing public interface, 872 goal of, 883 InitializeComponent() method, 882 naming, 878 property coercion callbacks, role of, 875 UserControl class, 871, 882 using binding expressions to repurpose core property, 877 writeable control properties as usually dependency properties, 872 user interface accommodating large monitors and highresolution displays, 25 bitmap-based interfaces as resolutiondependent, 25 building localizable interfaces, 328 creating modular interfaces, 115 creating resolution-independent, sizeindependent interfaces in WPF, 78 handling localized text, 113 integrating video content into, localizing FontFamily property, 329 migrating from Windows Forms to WPF, 918 separating completely from code, vector graphics and, 11 window as only holding single element, 78 User32, 1, 17, 21 lack of support for graphical scaling, windowing model, 372 WPF and, UserControl class, 121, 871 Binding.RelativeSource property, 878 Border element, 882 changing source of routed events, 882 ContentPresenter, 882 description of, 869 differentiating user controls and custom controls, 882 Focusable property, 882 HorizontalAlignment property, 882 InitializeComponent() method, 882 IsTabStop property, 882 Name property, 878 Padding property, 877 VerticalAlignment property, 882 UserPageRangeEnabled property, 733 V ValidateValueCallback, 143–145, 148 ValidatingType property, 931 validation adding it to Binding.ValidationRules collection, 551 AdornedElementPlaceholder, 555, 557 applying property validation carelessly, 547 applying when using TwoWay or OneWayToSource binding, 546 bubbling, 553 building validation directly into controls, 545 checking InnerException property of TargetInvocationException, 553 code example for disallowing negative numbers, 546 contents of ValidationError object, 553 creating error templates, 555 DataErrorValidationRule, 548–550 defining at binding level, 546 displaying error content in ToolTip, 556 ErrorContent property, 551, 553 ExceptionValidationRule, 547, 552 FormHasErrors() method, 554 getting list of all outstanding errors, 553 handling Error event, 553 HasError property, 548 how WPF handles validation failures, 547 IsValid property, 551 NotifyOnValidationError property, 548 options for catching invalid values, 545 raising errors in data object, 545–546 962-4 Index.qxd 3/5/08 8:22 AM Page 1047 ■INDEX vbc.exe csc.exe compiler, 56 vbproj file, 278 vector graphics, designing interfaces with, 11 Vector3DAnimationUsingKeyFrames, 785 VerifyAccess() method, 943 vertex shaders, defined, VerticalAlignment property, 84, 882 VerticalContentAlignment property, 123 VerticalScrollBarVisibility property, 127, 207 video cards examining current rendering tier programmatically, graphics routines, render-bound vs processor-bound, hardware acceleration and out-of-date drivers, rendering tiers, running rich WPF applications on older video cards, WDDM and XPDM drivers, video, mapping to 3-D surface, 849 VideoDrawing class, 815 View property, 596, 618 ViewBase class, 618 Viewbox class determining shape’s ordinary, nonViewbox size, 380 proportional scaling and, 138 resizing shapes proportionally in canvas, 378 scaling function of, 136 Stretch property, 138, 379 StretchDirection property, 138 vector drawings using fixed coordinates, 136 Viewport2DVisual3D class, 862–863 Viewport3D class Camera property, 823, 831 Children property, 823 ClipToBounds inherited property, 823 hosting any 3-D object that derives from Visual3D, 823 light source as object in viewport, 823 using as content of window or page, 822 Viewport3DVisual class, 440 ViewportSize property, 488 ViewportUnits property, 403 views, 955 add-in, 962 host, 964 ViewToContractAdapter() method, 976 virtual key state, 175 VirtualizingStackPanel, 81, 615 Visibility property, 116, 174, 222, 774, 927 visual add-ins, 974–977 Visual Basic C#, 24 Visual class, 17, 19 Find it faster at http://superindex.apress.com/ reacting to validation errors, 553 setting NotifyOnValidationError property, 553 TargetInvocationException, 553 using same validation rule for more than one binding, 552 Validation class, 547 validation rule for restricting decimal values, 550 ValidationError object, 548 Validation.ErrorTemplate property, 548 ValidationResult object, 551 ValidationRules collection, 547 ValidationRule.Validate() method, 548 visual indication of errors in bound controls, 548 writing custom validation rules, 550 Validation class, 547 ValidationError object, 548, 553 Validation.ErrorTemplate property, 548 ValidationResult object, 551 ValidationRules collection, 547 ValidationRule.Validate() method, 548 value converters, 569 applying conditional formatting, 542 BitmapImage class, 541 converting from display format back to number, 538 converting raw binary data into WPF BitmapImage object, 539 creating, 536 creating converter object in Resources collection, 539 creating objects with, 539 data triggers, 544 Decimal.ToString() method, 536 evaluating multiple properties, 544 format strings, 537 formatting strings, 535 ImagePathConverter, code example, 540 IMultiValueConveter interface, 544–545 mapping project namespace to XML namespace prefix, 538 MultiBinding, 544 Parse() method, 538 PriceConverter class, 538 reusing your formatting logic with other templates, 570 SuppressExceptions property, 541 System.Globalization.NumberStyles value, 538 TryParse() method, 538 uses for, 535 using custom IValueConverter, 542 Value property, 215, 888 ValueChanged event, 215 1047 962-4 Index.qxd 1048 3/5/08 8:22 AM Page 1048 ■INDEX AddLogicalChild() method, 442 AddVisualChild() method, 442 ContainerVisual class, 440 defining graphical element as Visual object, 440 DrawingVisual class, 436, 440 GetVisualChild() method, 443 UIElement class, 440 Viewport3DVisual class, 440 VisualChildrenCount property, 443 visual layer model, 440 Visual Studio, 6, 23, 322 adding resource dictionary, 473 Application class and, 60 App.xaml, 60 Automatically Increment Revision with Each Publish setting, 282 choosing Custom Control Library (WPF) project type, 868 choosing Run As Administrator option, 983 creating PageFunction in, 274 creating XAML with, 23–24 debugging XBAP projects in, 278 format strings, 537 Main() method, creating, 60 procedure for installing ClickOnce application, 990 publishing application to virtual directory in, 983 publishing ClickOnce application to web server, 981 setting Build Action to Resource, 191 Setup Project template, 979 Solution Explorer, 60, 63, 920, 925, 934 two-stage compilation process for WPF applications, 54 updating ClickOnce application automatically, 992 using Grid in, 96 using StackPanel in, 82 using XAML Browser Application template, 278 Windows Forms designer, 921 wrapper class as component-specific, 928 visual tree defined, 455 examining programmatically, 456 expanding upon logical tree, 455 Snoop utility, 458 using with styles and templates, 456 VisualTreeDisplay window, code example, 457 VisualTreeHelper class, list of methods, 456 Visual3D class, 747 VisualBrush animating special effects, 406 animation possibilities of, 782 creating reflection effect using OpacityMask property, 408 filling surface with element’s visual content, 405 markup for copying button’s appearance, 405 markup for creating VisualBrush that loops video playback, 849 markup for painting text box with mirrored text, 408 VisualChildrenCount property, 443 visual-layer classes, 723 VisualTreeHelper class drilling down through visual tree of window, 456 GetChild() method, 456 HitTest() method, 446, 448, 857 list of methods, 456 VisualTreeHelper.HitTest() method, 861 Volume property, 808 W WAV audio, 795 WCF (Windows Communication Foundation), 11, 70 WDDM (Windows Vista Display Driver Model), Web browser, 260 WebBrowser control, 14, 250, 256, 920 WebException, 255 WF (Windows Workflow Foundation), 11, 26 WF XAML, 26 WhereIterator class, 533 whitespace, handling, 42–43 Width property, 86 Win32, hosting in WPF, 939 Win32PrintDialog, 712 Window class, 120–121, 252 adding sizing grip to shaped window, 237 AdornerDecorator class, 490 allowing single nested element, 123 AllowsTransparency property, 231 Background property, 219 BorderBrush property, 219 BorderThickness property, 219 calling SaveSize() when window is closing, 226 calling SetSize() when window is first opened, 226 centering window in available screen area, 223 checking result of dialog box window, 229 client and nonclient areas defined, 219 Close() method, 222 962-4 Index.qxd 3/5/08 8:22 AM Page 1049 ■INDEX Window element, 27 window handles, 929 Window.Loaded event, 68 Window.Owner property, 68 Window.Resources collection, 947 Windows Communication Foundation (WCF), 11, 70 Windows Forms, 77 accelerator keys, 937 adding ActiveX content to Windows Forms application, 928 advantages of DataGridView over GridView, 619 airspace rule, 928 ambient properties, 190 Application Updater Component, 982 assessing interoperability with WPF, 917 BackgroundWorker class, 924 BindingList collection, 529 CheckedListBox control, 615, 920 classes not needing interoperability, 923 ColorDialog class, 924 comparing dialog model to that in WPF, 230 comparison to WPF, 14 ContextMenuStrip class, 924–925 coordinate system for sizing controls, 932 creating user controls, 932 data binding, 931 DataGridView control, 14, 633, 920 DateTimePicker, 920 DialogResult enumeration, 922 ElementHost class, 922, 928, 938 EnableModelessKeyboardInterop() method, 922 EnableVisualStyles() method, 923, 932 EnableWindowsFormsInterop() method, 922 ErrorProvider, 920 extender providers, 39 FlowLayoutPanel, 905 FolderBrowserDialog class, 924 FontDialog class, 924 Form class, 219 Form.ShowDialog() method, 922 glue code, 920 having WPF controls receive keyboard input, 922 HelpProvider, 920 HelpProvider component, 14 hooking events up to control using XAML, 931 hosting Windows Forms controls in WPF, 930 hosting WPF controls in, 934 Icon property, 924 ImageList, 920 Find it faster at http://superindex.apress.com/ closing window, 222 comparison to Page class, 252 creating and displaying several modeless windows, 222 creating public property in dialog window, 229 creating resizable window, 223 deciding window location at runtime, 223 designating accept and cancel buttons in dialog window, 229 dialog model, defined, 229 DialogResult property, 229 displaying modal window, 222 displaying modeless window, 222 DragMove() method, 236 Hide() method, 222 hiding window from view, 222 icon (.ico) files, 220 Left property, 224 Loaded event, 242 LocationChanged event, 222 modeless windows and synchronization code, 222 MouseLeftButtonDown event, 236 obtaining dimensions of current screen, 223 owned windows as displayed modelessly, 228 OwnedWindows property, 228 positioning window on screen, 223 removing owned windows, 228 removing window frame, 219 ResizeMode property, 237, 492 RestoreBounds property, 224 saving and restoring window location, 224 setting exact window position, 223 setting Owner property, 228 setting Visibility property to Hidden, 222 Show() method, 222 ShowDialog() method, 222, 229 storing current position of several windows, 225 storing window position in user-specific configuration file, 224 SystemParameters class, 223 System.Windows.Rect, 224 table of properties, 219 Tag property, 492 Title property, 492 Top property, 224 using CenterOwner for WindowState, 223 using Left and Right properties, 223 window ownership, 228 Windows property, 226 WindowStartupPosition property, 220 WindowStateChanged event, 222 WindowStyle property, 219, 231 1049 962-4 Index.qxd 1050 3/5/08 8:22 AM Page 1050 ■INDEX incorporating lower-level GDI+ drawing support in animation, 742 interoperability problems with keyboard handling, 935 ISupportInitialize interface, 147 MaskedTextBox control, 892–894, 920 MaskedTextProvider class, 892 MDI windows, 920 migrating applications to WPF, 917 missing WPF controls and features, table of, 918 mixing windows and forms, 920–923 mnemonics, 937 no need for wrapper class, 928 NotifyIcon class, 924 overlapping of WPF and Windows Forms content, 928 PageSetupDialog class, 924 preventing naming clashes among Windows Forms and WPF namespaces, 932 primary interop assembly, 933 PrintPreviewDialog class, 924 property map conversions, table of, 938 property mapping, 937 property translators, 937 PropertyGrid, 920 quartz.dll library, 795 runtime callable wrappers (RCWs), 933 SoundPlayer class, 924 System.ComponentModel.MaskedTextProvider, 894 System.Drawing namespace, 345 System.Drawing.dll, 921, 925 System.Drawing.Graphics class, 241 System.Windows.Forms.dll, 921, 925 TypeConverter infrastructure, 931 User32 library, 908 using ampersand character to identify shortcut key, 194 using separate window handle (hwnd), 929 Visual Basic C# and, 24 visual styles for controls and, 923 visual styles for Windows Forms controls, 923 WebBrowser, 920 WebBrowser control, 14 Windows Forms toolkit, 920 WindowsFormsHost class, 928, 930, 932, 938 z-index, 930 Windows Forms toolkit, 212 Windows graphics, Windows Media Player, 5, 795, 796 Windows print queue, 711 Windows property, 226 Windows SDK NET Framework 3.0 Samples, 245 Windows Vista adjusting system DPI setting, bitmap scaling, 10 built-in support for speech recognition, 818 creating and viewing XPS documents, 694 Custom DPI Setting dialog box, 11 Desktop Window Manager (DWM), 17 Disable Display Scaling on High DPI Settings, 11 Internet Information Services (IIS) 7, 983 milcore.dll, 17 Narrator screen reader, 816 new task dialog box, functions of, 245 no WPF support for Vista-style dialog boxes, 245 printing XPS content, 737 publishing applications to local web server, 983 Sound icon, 799 taking advantage of Vista-specific APIs, 246 Use Windows XP Style DPI Scaling, 9–11 User Account Control (UAC), 74, 983, 991 using Aero Glass effect, 240 Windows Vista Display Driver Model (WDDM), Windows Workflow Foundation (WF), 11, 26 Windows XP lack of support for speech recognition, 818 MediaPlayer and 64-bit version of XP, 799 Narrator screen reader, 816 no antialiasing on edges of 3-D shapes, 836 Sounds and Audio Devices icon, 799 Windows XP Display Driver Model (XPDM), WindowsBase.dll, 17 WindowsCodecs.dll, 17 WindowsFormsApplicationBase class, 70, 71 WindowsFormsHost class, 394, 928, 930, 932, 938 Window.ShowDialog() method, 922 WindowStartupPosition property, 220 WindowStateChanged event, 222 WindowStyle property, 219, 231 WindowTitle property, 253–254 Word 2007 XML (WordML), 661 Word, Microsoft, 69, 689 WordML (Word 2007 XML), 661 WorkArea property, 223 WorkerReportsProgress property, 951 WorkerSupportsCancellation property, 952 WPF Everywhere (WPF/E), 15 WPF XAML, 26 WpfApp class, 71 962-4 Index.qxd 3/5/08 8:22 AM Page 1051 ■INDEX WPF/E (WPF Everywhere), 15 WrapBreakPanel, 905, 907 WrapPanel, 98 basing WrapBreakPanel on, 906 code example for series of buttons, 89 controlling small-scale details in user interface, 89 default settings, 89 description of, 80 Dock property, 90 extending capabilities of, 905 LastChildFill, 90 setting order of docking controls, 91 WrapPanel class, 115 wrapper classes, 49, 928 Write() method, 738–739 WriteAsync() method, 738–739 WritingCompleted event, 740 XAML element, 27 Adobe Illustrator plug-in for, 439 advantages of, 21 Application element, 27 Application tag, 61 Application.g.vb App.g.cs file, 61 Application.xaml.vb App.xaml.cs file, 63 AssemblyName, 47 attached properties, 37, 38 attaching name to Grid element, 30 BAML, 26 basics of, 27 bridging gap between string values and nonstring properties, 33 building simple no-code XAML files, 57 C# and, 21 case-insensitivity of type converters, 34 case-sensitivity of, 34 Class attribute, 29, 61 classes that define their own Name property, 31 code-behind class, 29 coding styles for creating WPF application, 49 collapsing whitespace, tabs, and line breaks in XAML, 669 compiling, 26 complex properties, 34 Connect() method, 55 connecting event handlers, 29 container controls, 41 containment, 27 Content property, 41 ContentControl class, 42 ContentProperty attribute, 39–41 Find it faster at http://superindex.apress.com/ X controls containing collection of visual items, 41 controls containing singular content, 41 converter for Adobe Flash files, 439 core WPF namespace, 29 core XAML namespace, 29 creating blank window with, 27 creating custom wrapper classes, 49 creating with Visual Studio, 23, 24 declarative animation, 757 defined, 26 dependency properties, 38 DependencyObject class, 38, 53 design tools and, 25 designing WPF application in Visual Studio, 25 distinguishing properties from other types of nested content, 35 DockPanel object, 54 eight ball example, full window definition, 46 eight ball window and its controls, 32 element attributes as setting element properties, 33 embedding BAML as resource into DLL or EXE assembly, 26 entity references, 42 enumerations, 33 event model in WPF, 44 event routing, 44 example of bare-bones XAML document, 27 Expression Design’s built-in XAML export, 439 extension classes, 37 FileStream class, 49 FrameworkElement class, 31 graphical user interfaces before WPF, 24 Grid element, 27 IDictionary, 39 IList, 39 including Name attribute in control, 30 InitializeComponent() method, 50 instantiating NET objects, 23 integrating workflow between developers and designers, 23 ItemsControl class, 42 lack of public fields or call methods in, 48 lack of support for inline calculations, 759 loading and compiling, 49 loading XAML dynamically vs compiling XAML to BAML, 54 LogicalTreeHelper, 54 loose XAML files, 56 mapping element to instance of NET class, 27 1051 962-4 Index.qxd 1052 3/5/08 8:22 AM Page 1052 ■INDEX mapping NET namespace to XML namespace, 47 merging code with designer-generated file, 30 Microsoft Expression Blend, 23 namespace prefixes, 48 namespaces, defining, 28 nesting elements, 27, 39 NET objects and, 26 no one-to-one mapping between XML and NET namespaces, 29 no support for parameterized constructors, 48 no-argument constructors, 48 NullExtension, 37 Page element, 27 Panel class, 40, 42 parser, 28 parser error due to no associated type converter, 34 parser’s procedure for finding type converter, 34 parsing and validation of at compile time, 34 partial classes, contents of, 55 problems in exporting content to bitmap format, 25 properties supporting more than one type of collection, 40 property-element syntax, 34 ProvideValue(), 37 replacing attribute with nested element, 358 replacing XAML tags with set of code statements, 36 RuntimeNameProperty attribute, 31 separating graphical content from code, 24 setting background and foreground colors in, 185 setting class properties through attributes, 27 setting complex property, 35 setting mouse cursor in, 193 setting property value dynamically, 36 setting type converter at class level, 34 setting x:Key attribute, 39 Silverlight XAML, 26 similarity of attached properties to extender providers, 39 simple properties and type converters, 33 special characters, 42 start tag attributes, 28 StartupUri property, 61 StaticExtension, 37 subsets of, 26 System.Windows.Markup.MarkupExtension, 37 Text property, 41 TextBox class, 33, 38, 41 top-level elements, 27 type converters, 33 TypeConverter attribute, 34 TypeExtension, 37 using code-behind class to manipulate controls programmatically, 30 using device-independent units in measurements, 28 using dictionary collection, 39 using markup extension, 36 using markup extensions as nested properties, 37 using to construct WPF user interfaces, 23 using TypeConverter attribute on property declaration, 34 using types from other namespaces, 47 using underscore to identify shortcut key, 194 using without compiling, 26 using xml:space="preserve" attribute on element, 43 Visual Studio, 23 WF XAML, 26 whitespace, handling, 42–43 Window element, 27 Windows Workflow Foundation (WF), 26 WPF XAML, 26 xamlc.exe compiler, 54 XamlReader class, 50, 52 XML character entities, table of, 42 XML Paper Specification (XPS), 26 xmlns attribute, 28 XPS XAML, 26 XAML browser application See XBAP xamlc.exe compiler, 54 XamlParseException, 168, 347 XamlReader class, 50, 52, 466, 684, 686 XamlWriter class, 463, 465, 685 XBAP (XAML browser application), 12 advantages of, 277 ApplicationExtension tag, 278 ApplicationName.exe, 280 ApplicationName.exe.manifest, 280 ApplicationName.xbap, 280 automatically generated certificate file, 280 CodeAccessPermission class, 285 coding for different security levels, 285 combining XBAP and stand-alone applications, 284 creating, 260, 278 creating XBAP that runs with full trust, 283 debugging, 281 962-4 Index.qxd 3/5/08 8:22 AM Page 1053 ■INDEX XML character entities, table of, 42 declaring namespaces in, 28 namespaces as URIs, 29 xmlns attribute, 28 XML Paper Specification (XPS), 26, 326, 694 XmlDataProvider, 602 Binding.XPath property, 606 functions of, 605 identifying root node of XML document, 606 IsAsynchronous property, 605 loading XML content asynchronously, 605 setting XPath property in binding, 606 Source property, 605 using as quick way to extract XML content, 605 using XPath expressions, 606 xmlns attribute, 28 xml:space attribute, 670 xml:space="preserve" attribute, 43 XmlStreamStore class, 697 XPath expressions, 606 XPDM (Windows XP Display Driver Model), XPS (XML Paper Specification), 26, 326, 694 XpsDocument class, 709, 719 AddFixedDocument() method, 694 CreateXpsDocumentWriter () method, 738 GetFixedDocumentSequence() method, 694 GetTempFileName() method, 738 loading, displaying, and printing XPS file, 737 RemoveSignature() method, 694 role of DocumentPaginator in printing, 737 SignDigitally() method, 694 using XPS document as print preview, 738 XpsDocumentWriter class CancelAsync() method, 740 printing directly to printer via XPS, 739 sending content to printer asynchronously, 712 using asynchronous printing, 739 Write() method, 738–739 WriteAsync() method, 738–739 WritingCompleted event, 740 Z ZAM 3D, 841 z-fighting (stitching), 834 ZIndex property, 108 Find it faster at http://superindex.apress.com/ defined, 276 Demand() method, 285 deploying, 279 designing and coding pages, 278 displaying more than one XBAP in same browser window, 290 as downloaded but not installed, 277 embedding XBAP in web page, 290 four key elements in csproj project file, 278 GetUserStoreForApplication() method, 286 HostInBrowser tag, 278 Install tag, 278 Internet Explorer or 7, 277 IsBrowserHosted property, 284 IsolatedStorageFile.GetDirectoryNames() method, 287 IsolatedStorageFile.GetFileNames() method, 287 IsolatedStorageFileStream, 286 key supported and disallowed features, table of, 282 limited permissions and stringent security of, 277 manually clearing ClickOnce cache, 281 NET 3.0, 277 NET Framework and code access security, 282 not having FileIOPermission for local hard drive, 287 opening secondary window using Popup control, 287 performing disallowed action, 282 rebuilding application and applying new publication version, 282 requirements, 277 running inside browser window, 276 running with permissions of Internet zone, 282 security, 282 setting IsEnabled property to disable user interface, 288 TargetZone tag, 278 updating publish version, 281 using tag, 290 using isolated storage to provide virtual file system, 286 using xbap extension, 278 xbap extension, 278 Xceed Software, 620 x:Key attribute, setting, 39 1053 ... FM.qxd 3/ 6/08 10 :54 AM Page i Pro WPF with VB 2008 Windows Presentation Foundation with NET 3. 5 Matthew MacDonald 962-4 FM.qxd 3/ 6/08 10 :54 AM Page ii Pro WPF with VB 2008: Windows Presentation Foundation. .. work with NET 2.0, NET 3. 0, or NET 3. 5 Although it’s obviously not possible to create a WPF application with NET 2.0, both NET 3. 0 and NET 3. 5 have WPF support You may choose to target NET 3. 0... dozen books about NET programming, including Pro NET 2.0 Windows Forms and Custom Controls in VB 20 05 (Apress, 2006) and Pro ASP .NET 3. 5 in C# 2008 (Apress, 2007) He lives in Toronto with his wife

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

Xem thêm:

TỪ KHÓA LIÊN QUAN

Mục lục

    Contents at a Glance

    About the Technical Reviewer

    WPF: A Higher-Level API

    The Architecture of WPF

    Properties and Events in XAML

    Using Types from Other Namespaces

    Loading and Compiling XAML

    The Application Life Cycle

    Understanding Layout in WPF

    Simple Layout with the StackPanel

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN