Pro WPF in C# 2010 Windows presentation foundation in .NET 4

Gespeichert in:
Bibliographische Detailangaben
1. Verfasser: MacDonald, Matthew (VerfasserIn)
Format: Buch
Sprache:English
Veröffentlicht: [Berkeley, Calif.] Apress 2010
Schriftenreihe:The expert's voice in .NET
Schlagworte:
Online-Zugang:Inhaltsverzeichnis
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!

MARC

LEADER 00000nam a2200000 c 4500
001 BV036435792
003 DE-604
005 20121101
007 t|
008 100504s2010 xx a||| |||| 00||| eng d
020 |a 9781430272052  |c pbk  |9 978-1-4302-7205-2 
035 |a (OCoLC)699719013 
035 |a (DE-599)GBV61671338X 
040 |a DE-604  |b ger 
041 0 |a eng 
049 |a DE-706  |a DE-523 
084 |a ST 250  |0 (DE-625)143626:  |2 rvk 
100 1 |a MacDonald, Matthew  |e Verfasser  |0 (DE-588)12398209X  |4 aut 
245 1 0 |a Pro WPF in C# 2010  |b Windows presentation foundation in .NET 4  |c Matthew MacDonald 
264 1 |a [Berkeley, Calif.]  |b Apress  |c 2010 
300 |a XXXIII, 1181 S.  |b Ill. 
336 |b txt  |2 rdacontent 
337 |b n  |2 rdamedia 
338 |b nc  |2 rdacarrier 
490 0 |a The expert's voice in .NET 
650 0 7 |a Microsoft dot net 4.0  |0 (DE-588)7701686-5  |2 gnd  |9 rswk-swf 
650 0 7 |a Windows Presentation Foundation  |0 (DE-588)7551149-6  |2 gnd  |9 rswk-swf 
650 0 7 |a C sharp  |0 (DE-588)4616843-6  |2 gnd  |9 rswk-swf 
689 0 0 |a Windows Presentation Foundation  |0 (DE-588)7551149-6  |D s 
689 0 1 |a C sharp  |0 (DE-588)4616843-6  |D s 
689 0 2 |a Microsoft dot net 4.0  |0 (DE-588)7701686-5  |D s 
689 0 |8 1\p  |5 DE-604 
776 0 8 |i Erscheint auch als  |n Online-Ausgabe  |z 978-1-4302-7204-5 
856 4 2 |m Digitalisierung UB Bamberg  |q application/pdf  |u http://bvbr.bib-bvb.de:8991/F?func=service&doc_library=BVB01&local_base=BVB01&doc_number=020308261&sequence=000002&line_number=0001&func_code=DB_RECORDS&service_type=MEDIA  |3 Inhaltsverzeichnis 
883 1 |8 1\p  |a cgwrk  |d 20201028  |q DE-101  |u https://d-nb.info/provenance/plan#cgwrk 
943 1 |a oai:aleph.bib-bvb.de:BVB01-020308261 

Datensatz im Suchindex

_version_ 1819746013961781248
adam_text ■About the Author ...........................................................................................................................xxvi ■About the Technical Reviewer ......................................................................................................xxvii ■Acknowledgments .......................................................................................................................xxviii ■Introduction ...................................................................................................................................xxix ■Chapter 1: Introducing WPF ...............................................................................................................1 The Evolution of Windows Graphics ................................................................................................1 DirectX: The New Graphics Engine .............................................................................................2 Hardware Acceleration and WPF ................................................................................................3 WPF: A Higher-Level API ................................................................................................................4 Windows Forms Lives On ...........................................................................................................6 DirectX Also Lives On .................................................................................................................6 Silverlight ...................................................................................................................................6 Resolution Independence ...............................................................................................................7 WPF Units ..................................................................................................................................8 System DPI ................................................................................................................................9 Bitmap and Vector Graphics .....................................................................................................12 The Architecture of WPF ...............................................................................................................12 The Class Hierarchy .................................................................................................................14 WPF 4..........................................................................................................................................17 New Features ...........................................................................................................................17 The WPF Toolkit .......................................................................................................................18 Visual Studio 2010...................................................................................................................18 The Last Word ..............................................................................................................................21 ■Chapter 2: XAML ..............................................................................................................................23 Understanding XAML ....................................................................................................................24 Graphical User Interfaces Before WPF ......................................................................................24 iv li CONTENTS The Variants of XAML ...............................................................................................................25 XAML Compilation ....................................................................................................................26 XAML Basics ................................................................................................................................27 XAML Namespaces ..................................................................................................................28 The Code-Behind Class ............................................................................................................30 Properties and Events in XAML .....................................................................................................32 Simple Properties and Type Converters ....................................................................................34 Complex Properties ..................................................................................................................35 Markup Extensions ...................................................................................................................37 Attached Properties ..................................................................................................................38 Nesting Elements .....................................................................................................................39 Special Characters and Whitespace .........................................................................................42 Events ......................................................................................................................................44 The Full Eight Ball Example ......................................................................................................45 Using Types from Other Namespaces ...........................................................................................46 Loading and Compiling XAML .......................................................................................................48 Code-Only ................................................................................................................................48 Code and Uncompiled XAML ....................................................................................................51 Code and Compiled XAML ........................................................................................................53 XAML Only ...............................................................................................................................55 XAML 2009..................................................................................................................................56 Automatic Event Hookup ..........................................................................................................56 References ...............................................................................................................................58 Built-in Types ...........................................................................................................................58 Advanced Object Creation ........................................................................................................59 The Last Word ..............................................................................................................................60 IChapter 3: Layout .............................................................................................................................61 Understanding Layout in WPF .......................................................................................................61 The WPF Layout Philosophy .....................................................................................................62 The Layout Process ..................................................................................................................63 The Layout Containers .............................................................................................................63 Simple Layout with the StackPanel ...............................................................................................65 ■ CONTENTS Layout Properties .....................................................................................................................67 Alignment ................................................................................................................................68 Margin .....................................................................................................................................69 Minimum, Maximum, and Explicit Sizes ...................................................................................71 The Border ...............................................................................................................................74 The WrapPanel and DockPanel .....................................................................................................75 The WrapPanel .........................................................................................................................76 The DockPanel .........................................................................................................................77 Nesting Layout Containers .......................................................................................................79 The Grid .......................................................................................................................................80 Fine-Tuning Rows and Columns ...............................................................................................83 Layout Rounding ......................................................................................................................85 Spanning Rows and Columns ...................................................................................................86 Split Windows ..........................................................................................................................87 Shared Size Groups ..................................................................................................................91 The UniformGrid .......................................................................................................................93 Coordinate-Based Layout with the Canvas ...................................................................................94 Z-Order ....................................................................................................................................95 ThelnkCanvas .........................................................................................................................96 Layout Examples ..........................................................................................................................99 A Column of Settings ................................................................................................................99 Dynamic Content ...................................................................................................................100 A Modular User Interface ........................................................................................................102 The Last Word ............................................................................................................................104 IChapter4: Dependency Properties ................................................................................................105 Understanding Dependency Properties .......................................................................................105 Defining a Dependency Property ............................................................................................106 Registering a Dependency Property ........................................................................................107 Adding a Property Wrapper ....................................................................................................109 How WPF Uses Dependency Properties ..................................................................................110 Shared Dependency Properties ..............................................................................................111 Attached Dependency Properties ............................................................................................112 VI ■ CONTENTS Property Validation .....................................................................................................................114 The Validation Callback ..........................................................................................................114 The Coercion Callback ...........................................................................................................115 The Last Word ............................................................................................................................118 ¡Chapter 5: Routed Events ..............................................................................................................119 Understanding Routed Events .....................................................................................................119 Defining, Registering, and Wrapping a Routed Event ..............................................................120 Sharing Routed Events ...........................................................................................................121 Raising a Routed Event ..........................................................................................................121 Handling a Routed Event ........................................................................................................121 Event Routing .............................................................................................................................123 The RoutedEventArgs Class ....................................................................................................125 Bubbling Events .....................................................................................................................126 Handling a Suppressed Event .................................................................................................129 Attached Events .....................................................................................................................129 Tunneling Events ...................................................................................................................131 WPF Events ................................................................................................................................133 Lifetime Events ......................................................................................................................133 Input Events ...........................................................................................................................136 Keyboard Input ...........................................................................................................................137 Handling a Key Press .............................................................................................................138 Focus .....................................................................................................................................140 Getting Key State ...................................................................................................................141 Mouse Input ...............................................................................................................................143 Mouse Clicks .........................................................................................................................144 Capturing the Mouse ..............................................................................................................146 Drag-and-Drop ......................................................................................................................146 Multitouch Input .........................................................................................................................149 The Levels of Multitouch Support ...........................................................................................150 Raw Touch .............................................................................................................................150 Manipulation ..........................................................................................................................153 Inertia ....................................................................................................................................156 vii ■ CONTENTS The Last Word............................................................................................................................157 IChapter 6: Controls........................................................................................................................159 The Control Class....................................................................................................................... 160 Background and Foreground Brushes .....................................................................................160 Fonts .....................................................................................................................................163 Mouse Cursors .......................................................................................................................168 Content Controls ........................................................................................................................169 The Content Property .............................................................................................................171 Aligning Content .....................................................................................................................173 The WPF Content Philosophy ..................................................................................................174 Labels ....................................................................................................................................175 Buttons ..................................................................................................................................177 Tooltips ..................................................................................................................................180 Specialized Containers ...............................................................................................................188 The ScrollViewer ....................................................................................................................188 Headered Content Controls .........................................................................................................192 TheGroupBox ........................................................................................................................192 TheTabltem ...........................................................................................................................193 The Expander .........................................................................................................................195 Text Controls ..............................................................................................................................197 Multiple Lines of Text .............................................................................................................198 Text Selection ........................................................................................................................199 Spell Checking .......................................................................................................................200 The PasswordBox ..................................................................................................................202 Ust Controls ...............................................................................................................................202 TheListBox ............................................................................................................................203 TheComboBox .......................................................................................................................206 Range-Based Controls ................................................................................................................207 The Slider ..............................................................................................................................208 The ProgressBar ....................................................................................................................209 Date Controls .............................................................................................................................210 The Last Word ............................................................................................................................213 Vili ii CONTENTS ■Chapter 7: The Application .............................................................................................................215 The Application Life Cycle ..........................................................................................................215 Creating an Application Object ...............................................................................................216 Deriving a Custom Application Class...................................................................................... 217 Application Shutdown ............................................................................................................218 Application Events ..................................................................................................................220 Application Tasks .......................................................................................................................222 Showing a Splash Screen....................................................................................................... 222 Handling Command-Line Arguments ......................................................................................223 Accessing the Current Application ..........................................................................................224 Interacting Between Windows ................................................................................................225 Single-Instance Applications ..................................................................................................227 Assembly Resources ..................................................................................................................234 Adding Resources ..................................................................................................................234 Retrieving Resources .............................................................................................................236 PackURIs ..............................................................................................................................237 Content Files ..........................................................................................................................239 Localization ................................................................................................................................239 Building Localizable User Interfaces .......................................................................................240 Preparing an Application for Localization ................................................................................241 The Translation Process .........................................................................................................242 The Last Word ............................................................................................................................248 ■Chapter 8: Element Binding ...........................................................................................................249 Binding Elements Together ........................................................................................................249 The Binding Expression ..........................................................................................................250 Binding Errors ........................................................................................................................251 Binding Modes .......................................................................................................................251 Creating Bindings with Code ..................................................................................................254 Multiple Bindings ...................................................................................................................255 Binding Updates .....................................................................................................................259 Binding to Objects That Aren t Elements .....................................................................................260 Source ...................................................................................................................................261 ix ■ CONTENTS RelativeSource.......................................................................................................................261 DataContext...........................................................................................................................263 The Last Word............................................................................................................................264 ■Chapter 9: Commands................................................................................................................... 265 Understanding Commands .........................................................................................................265 The WPF Command Model .........................................................................................................267 The ICommand Interface ........................................................................................................267 The RoutedCommand Class ...................................................................................................268 The RoutedUICom mand Class ................................................................................................269 The Command Library ............................................................................................................269 Executing Commands ................................................................................................................271 Command Sources .................................................................................................................271 Command Bindings ................................................................................................................272 Using Multiple Command Sources ..........................................................................................275 Fine-Tuning Command Text ...................................................................................................276 Invoking a Command Directly .................................................................................................276 Disabling Commands .............................................................................................................277 Controls with Built-in Commands ...........................................................................................280 Advanced Commands ................................................................................................................282 Custom Commands ................................................................................................................282 Using the Same Command in Different Places ........................................................................284 Using a Command Parameter .................................................................................................286 Tracking and Reversing Commands .......................................................................................286 The Last Word ............................................................................................................................291 ■Chapter 10: Resources ...................................................................................................................293 Resource Basics ........................................................................................................................293 The Resources Collection .......................................................................................................294 The Hierarchy of Resources ...................................................................................................295 Static and Dynamic Resources ...............................................................................................297 Nonshared Resources ............................................................................................................299 Accessing Resources in Code .................................................................................................299 Application Resources ............................................................................................................300 S CONTENTS System Resources .................................................................................................................301 Resource Dictionaries ................................................................................................................302 Creating a Resource Dictionary ..............................................................................................302 Using a Resource Dictionary ...................................................................................................303 Sharing Resources Between Assemblies................................................................................ 304 The Last Word ............................................................................................................................307 ■Chapter 11: Styles and Behaviors ..................................................................................................309 Style Basics ...............................................................................................................................309 Creating a Style Object ...........................................................................................................313 Setting Properties ..................................................................................................................314 Attaching Event Handlers .......................................................................................................316 The Many Layers of Styles .....................................................................................................317 Automatically Applying Styles by Type ....................................................................................319 Triggers .....................................................................................................................................320 A Simple Trigger ....................................................................................................................321 An Event Trigger ....................................................................................................................323 Behaviors ...................................................................................................................................325 Getting Support for Behaviors .................................................................................................325 Understanding the Behavior Model .........................................................................................326 Creating a Behavior ................................................................................................................327 Using a Behavior ....................................................................................................................329 Design-Time Behavior Support in Blend .................................................................................330 The Last Word ............................................................................................................................331 IChapter 12: Shapes, Brushes, and Transforms ................................................................................333 Understanding Shapes ...............................................................................................................333 The Shape Classes .................................................................................................................334 Rectangle and Ellipse .............................................................................................................337 Sizing and Placing Shapes .....................................................................................................338 Scaling Shapes with a Viewbox ..............................................................................................341 Line .......................................................................................................................................343 Polyline ..................................................................................................................................344 Polygon ..................................................................................................................................345 Xl ■ CONTENTS Line Caps and Une Joins .......................................................................................................348 Dashes.................................................................................................................................. 349 Pixel Snapping .......................................................................................................................351 Brushes .....................................................................................................................................352 The SolidColorßrush...............................................................................................................353 The LinearGradientBrush ........................................................................................................354 The RadialGradientBrush ........................................................................................................356 The ImageBrush .....................................................................................................................358 A Tiled ImageBrush ................................................................................................................360 The VisualBrush .....................................................................................................................363 The BitmapCacheBrush ..........................................................................................................364 Transforms ................................................................................................................................365 Transforming Shapes .............................................................................................................367 Transforming Elements ..........................................................................................................369 Transparency .............................................................................................................................370 Making an Element Partially Transparent ...............................................................................370 Opacity Masks .......................................................................................................................372 The Last Word ............................................................................................................................374 ■Chapter 13: Geometries and Drawings ..........................................................................................375 Paths and Geometries ................................................................................................................375 Line, Rectangle, and Ellipse Geometries .................................................................................376 Combining Shapes with GeometryGroup ................................................................................377 Fusing Geometries with CombinedGeometry ..........................................................................379 Curves and Lines with PathGeometry .....................................................................................383 The Geometry Mini-Language ................................................................................................388 Clipping with Geometry ..........................................................................................................391 Drawings ...................................................................................................................................392 Displaying a Drawing .............................................................................................................394 Exporting Clip Art ...................................................................................................................396 The Last Word ............................................................................................................................398 IChapter 14: Effects and Visuals .....................................................................................................399 Visuals .......................................................................................................................................399 Xli ■ CONTENTS Drawing Visuals .....................................................................................................................400 Wrapping Visuals in an Element .............................................................................................402 Hit Testing .............................................................................................................................405 Complex Hit Testing ...............................................................................................................408 Effects .......................................................................................................................................411 BlurEffect ...............................................................................................................................412 DropShadowEffect .................................................................................................................413 ShaderEffect ..........................................................................................................................414 The WriteableBitmap Class .........................................................................................................416 Generating a Bitmap ..............................................................................................................416 Writing to a WriteableBitmap ..................................................................................................417 More Efficient Pixel Writing ....................................................................................................419 The Last Word ............................................................................................................................422 ■Chapter 15: Animation Basics ........................................................................................................423 Understanding WPF Animation ...................................................................................................423 Timer-Based Animation ..........................................................................................................424 Property-Based Animation ......................................................................................................425 Basic Animation .........................................................................................................................426 The Animation Classes ...........................................................................................................426 Animations in Code ................................................................................................................429 Simultaneous Animations .......................................................................................................434 Animation Lifetime .................................................................................................................434 The Timeline Class .................................................................................................................436 Storyboards...............................................................................................................................439 The Storyboard......................................................................................................................440 Event Triggers ........................................................................................................................440 Overlapping Animations .........................................................................................................443 Synchronized Animations .......................................................................................................444 Controlling Playback ..............................................................................................................445 Monitoring Progress ...............................................................................................................450 Animation Easing .......................................................................................................................452 Using an Easing Function .......................................................................................................452 Xlii ■ CONTENTS Easing In and Easing Out ........................................................................................................453 Easing Function Classes .........................................................................................................455 Creating a Custom Easing Function ........................................................................................458 Animation Performance ..............................................................................................................460 Desired Frame Rate ...............................................................................................................460 Bitmap Caching .....................................................................................................................463 The Last Word ............................................................................................................................465 ■Chapter 16: Advanced Animation ...................................................................................................467 Animation Types Revisited .........................................................................................................467 Animating Transforms ............................................................................................................468 Animating Brushes .................................................................................................................472 Animating Pixel Shaders ........................................................................................................475 Key Frame Animation .................................................................................................................477 Discrete Key Frame Animations ..............................................................................................478 Easing Key Frames ................................................................................................................479 Spline Key Frame Animations .................................................................................................480 Path-Based Animation ................................................................................................................481 Frame-Based Animation .............................................................................................................483 Storyboards in Code ...................................................................................................................487 The Main Window ..................................................................................................................488 The Bomb User Control ..........................................................................................................490 Dropping the Bombs ..............................................................................................................491 Intercepting a Bomb ...............................................................................................................494 Counting Bombs and Cleaning Up ..........................................................................................496 The Last Word ............................................................................................................................498 IChapter 17: Control Templates ......................................................................................................499 Understanding Logical Trees and Visual Trees ............................................................................500 Understanding Templates ...........................................................................................................506 The Chrome Classes ..............................................................................................................509 Dissecting Controls ................................................................................................................510 Creating Control Templates ........................................................................................................513 A Simple Button .....................................................................................................................514 XIV ■ CONTENTS Template Bindings .................................................................................................................515 Triggers That Change Properties ............................................................................................517 Triggers That Use Animation ..................................................................................................520 Organizing Template Resources .................................................................................................521 Refactoring the Button Control Template ................................................................................522 Applying Templates with Styles ..............................................................................................524 Applying Templates Automatically ..........................................................................................527 User-Selected Skins ...............................................................................................................528 Building More Complex Templates .............................................................................................530 Nested Templates ..................................................................................................................531 Modifying the Scroll Bar .........................................................................................................533 The Control Template Examples .............................................................................................538 Visual States ..............................................................................................................................540 The Last Word ............................................................................................................................541 IChapter 18: Custom Elements .......................................................................................................543 Understanding Custom Elements in WPF ....................................................................................544 Building a Basic User Control .....................................................................................................547 Defining Dependency Properties ............................................................................................548 Defining Routed Events ..........................................................................................................551 Adding Markup ......................................................................................................................552 Using the Control ...................................................................................................................554 Command Support .................................................................................................................555 A Closer Look at User Controls ...............................................................................................558 Creating a Lookless Control ........................................................................................................559 Refactoring the Color Picker Code ..........................................................................................560 Refactoring the Color Picker Markup ......................................................................................560 Streamlining the Control Template .........................................................................................563 Theme-Specific Styles and the Default Style ..........................................................................566 Supporting Visual States ............................................................................................................568 Starting the FlipPanel Class ....................................................................................................569 Choosing Parts and States .....................................................................................................572 The Default Control Template .................................................................................................573 XV ■ CONTENTS Using the FlipPanel................................................................................................................580 Using a Different Control Template .........................................................................................581 Custom Panels ...........................................................................................................................582 The Two-Step Layout Process ................................................................................................583 The Canvas Clone ..................................................................................................................586 A Better Wrapping Panel ........................................................................................................587 Custom-Drawn Elements ...........................................................................................................590 The OnRenderO Method .........................................................................................................591 Evaluating Custom Drawing ...................................................................................................592 A Custom-Drawn Element ......................................................................................................593 A Custom Decorator ...............................................................................................................595 The Last Word ............................................................................................................................597 IChapter 19: Data Binding ...............................................................................................................599 Binding to a Database with Custom Objects ...............................................................................599 Building a Data Access Component ........................................................................................600 Building a Data Object ............................................................................................................603 Displaying the Bound Object ..................................................................................................604 Updating the Database ...........................................................................................................606 Change Notification ................................................................................................................607 Binding to a Collection of Objects ...............................................................................................609 Displaying and Editing Collection Items ..................................................................................610 Inserting and Removing Collection Items ................................................................................614 Binding to the ADO.NET Objects .............................................................................................615 Binding to a LINQ Expression .................................................................................................616 Improving Performance in Large Lists ........................................................................................619 Virtualization ..........................................................................................................................619 Item Container Recycling .......................................................................................................621 Deferred Scrolling ..................................................................................................................621 Validation ...................................................................................................................................621 Validation in the Data Object ..................................................................................................622 Custom Validation Rules .........................................................................................................626 Reacting to Validation Errors ..................................................................................................628 xvi ■ CONTENTS Getting a List of Errors........................................................................................................... 629 Showing a Different Error Indicator .........................................................................................630 Validating Multiple Values ......................................................................................................633 Data Providers ...........................................................................................................................636 The ObjectDataProvider ..........................................................................................................637 The XmlDataProvider .............................................................................................................640 The Last Word ............................................................................................................................642 ■Chapter 20: Formatting Bound Data ..............................................................................................643 Data Binding Redux ....................................................................................................................643 Data Conversion .........................................................................................................................645 The StringFormat Property .....................................................................................................645 Introducing Value Converters ..................................................................................................647 Formatting Strings with a Value Converter ..............................................................................648 Creating Objects with a Value Converter .................................................................................650 Applying Conditional Formatting .............................................................................................653 Evaluating Multiple Properties ................................................................................................654 List Controls ...............................................................................................................................656 List Styles ..................................................................................................................................658 The ItemContainerStyle ..........................................................................................................659 A ListBox with Check Boxes or Radio Buttons .........................................................................660 Alternating Item Style .............................................................................................................663 Style Selectors .......................................................................................................................665 Data Templates ..........................................................................................................................668 Separating and Reusing Templates ........................................................................................671 More Advanced Templates .....................................................................................................672 Varying Templates .................................................................................................................675 Template Selectors ................................................................................................................676 Templates and Selection ........................................................................................................679 Changing Item Layout ............................................................................................................684 TheComboBox ...........................................................................................................................686 The Last Word ............................................................................................................................689 IChapter 21: Data Views ..................................................................................................................691 XVII f CONTENTS The View Object .........................................................................................................................691 Retrieving a View Object ........................................................................................................692 Navigating with a View ...........................................................................................................692 Creating a View Declaratively .................................................................................................695 Filtering, Sorting, and Grouping ..................................................................................................697 Filtering Collections ................................................................................................................697 Filtering the DataTable ...........................................................................................................701 Sorting ...................................................................................................................................702 Grouping ................................................................................................................................703 The Last Word ............................................................................................................................707 ■Chapter 22: Lists, Grids, and Trees ................................................................................................709 TheListView ..............................................................................................................................710 Creating Columns with the GridView ......................................................................................711 Creating a Custom View .........................................................................................................715 TheTreeView .............................................................................................................................724 A Data-Bound TreeView .........................................................................................................724 Binding a DataSet to a TreeView ............................................................................................728 Just-in-Time Node Creation ...................................................................................................729 TheDataGrid ..............................................................................................................................732 Resizing and Rearranging Columns ........................................................................................734 Defining Columns ...................................................................................................................735 Formatting and Styling Columns .............................................................................................740 Formatting Rows ....................................................................................................................742 Row Details ............................................................................................................................744 Freezing Columns ..................................................................................................................745 Selection ................................................................................................................................745 Sorting ...................................................................................................................................746 DataGrid Editing .....................................................................................................................746 The Last Word ............................................................................................................................749 ■Chapter 23: Windows .....................................................................................................................751 The Window Class ......................................................................................................................751 Showing a Window ................................................................................................................754 xviii ■ CONTENTS Positioning a Window .............................................................................................................755 Saving and Restoring Window Location ..................................................................................756 Window Interaction ....................................................................................................................758 Window Ownership ................................................................................................................760 The Dialog Model ...................................................................................................................761 Common Dialog Boxes ...........................................................................................................762 Nonrectangular Windows ...........................................................................................................763 A Simple Shaped Window ......................................................................................................763 A Transparent Window with Shaped Content ..........................................................................766 Moving Shaped Windows .......................................................................................................768 Resizing Shaped Windows .....................................................................................................769 Putting It All Together: A Custom Control Template for Windows ............................................770 The Aero Glass Effect .................................................................................................................774 Programming the Windows 7 Taskbar ........................................................................................779 Using Jump Lists ...................................................................................................................779 Changing the Taskbar Icon and Preview .................................................................................784 The Last Word ............................................................................................................................790 ■Chapter 24: Pages and Navigation .................................................................................................791 Understanding Page-Based Navigation .......................................................................................791 Page-Based Interfaces ...............................................................................................................792 A Simple Page-Based Application with NavigationWindow ......................................................793 The Page Class ......................................................................................................................795 Hyperlinks ..............................................................................................................................796 Hosting Pages in a Frame ......................................................................................................799 Hosting Pages in Another Page ...............................................................................................800 Hosting Pages in a Web Browser ............................................................................................802 The Page History ........................................................................................................................803 A Closer Look at URIs in WPF .................................................................................................803 Navigation History ..................................................................................................................804 Maintaining Custom Properties ...............................................................................................805 The Navigation Service ...............................................................................................................806 Programmatic Navigation .......................................................................................................806 XIX ■ CONTENTS Navigation Events..................................................................................................................808 Managing the Journal............................................................................................................809 Adding Custom Items to the Journal.......................................................................................811 Page Functions ......................................................................................................................816 XAML Browser Applications ........................................................................................................819 XBAP Requirements ...............................................................................................................819 Creating an XBAP ...................................................................................................................820 Deploying an XBAP .................................................................................................................821 Updating an XBAP ..................................................................................................................823 XBAP Security ........................................................................................................................824 Full-Trust XBAPs ....................................................................................................................826 Combination XBAP/Stand-Alone Applications ..........................................................................826 Coding for Different Security Levels .......................................................................................827 Embedding an XBAP in a Web Page .......................................................................................832 The WebBrowser Control ............................................................................................................833 Navigating to a Page ..............................................................................................................833 Building a DOM Tree ..............................................................................................................835 Scripting a Web Page with .NET Code ....................................................................................837 The Last Word ............................................................................................................................840 ■Chapter 25: Menus, Toolbars, and Ribbons ...................................................................................841 Menus ........................................................................................................................................841 The Menu Class .....................................................................................................................841 Menu Items ............................................................................................................................843 The ContextMenu Class ..........................................................................................................845 Menu Separators ...................................................................................................................846 Toolbars and Status Bars ...........................................................................................................847 TheToolBar ...........................................................................................................................847 TheStatusBar ........................................................................................................................851 Ribbons ......................................................................................................................................852 Adding the Ribbon ..................................................................................................................853 Styling the Ribbon ..................................................................................................................854 Commands ............................................................................................................................855 xx ■ CONTENTS The Application Menu ............................................................................................................856 Tabs, Groups, and Buttons .....................................................................................................859 Ribbon Sizing .........................................................................................................................862 The Quick access Toolbar ......................................................................................................864 The Last Word ............................................................................................................................866 ■Chapter 26: Sound and Video .........................................................................................................865 Playing WAV Audio .....................................................................................................................865 The SoundPlayer ....................................................................................................................866 The SoundPlayerAction ..........................................................................................................867 System Sounds ......................................................................................................................868 The MediaPlayer ........................................................................................................................868 The MediaElement .....................................................................................................................871 Playing Audio Programmatically .............................................................................................871 Handling Errors ......................................................................................................................872 Playing Audio with Triggers ....................................................................................................872 Playing Multiple Sounds .........................................................................................................875 Changing Volume, Balance, Speed, and Position ....................................................................876 Synchronizing an Animation with Audio ..................................................................................878 Playing Video .........................................................................................................................880 Video Effects ..........................................................................................................................881 Speech ......................................................................................................................................885 Speech Synthesis ...................................................................................................................885 Speech Recognition ...............................................................................................................887 The Last Word ............................................................................................................................889 ■Chapter 27:3-D Drawing ...............................................................................................................889 3-D Drawing Basics ...................................................................................................................889 The Viewport ..........................................................................................................................890 3-D Objects ............................................................................................................................890 The Camera ...........................................................................................................................899 Deeper into 3-D.........................................................................................................................903 Shading and Normals .............................................................................................................905 More Complex Shapes ...........................................................................................................909 xxi ■ CONTENTS Model3DGroup Collections .....................................................................................................910 Materials Revisited .................................................................................................................912 Texture Mapping ....................................................................................................................914 Interactivity and Animations .......................................................................................................918 Transforms ............................................................................................................................919 Rotations ...............................................................................................................................920 A Fly Over ..............................................................................................................................921 The Trackball .........................................................................................................................923 Hit Testing .............................................................................................................................925 2-D Elements on 3-D Surfaces ...............................................................................................929 The Last Word ............................................................................................................................932 ■Chapter 28: Documents .................................................................................................................935 Understanding Documents .........................................................................................................935 Flow Documents ........................................................................................................................936 The Flow Elements .................................................................................................................937 Formatting Content Elements .................................................................................................939 Constructing a Simple Flow Document ...................................................................................941 Block Elements ......................................................................................................................942 Inline Elements ......................................................................................................................949 Interacting with Elements Programmatically ...........................................................................956 Text Justification ....................................................................................................................959 Read-Only Flow Document Containers .......................................................................................960 Zooming ................................................................................................................................961 Pages and Columns ...............................................................................................................962 Loading Documents from a File ..............................................................................................965 Printing ..................................................................................................................................966 Editing a Flow Document ............................................................................................................967 Loading a File ........................................................................................................................967 Saving a File ..........................................................................................................................969 Formatting Selected Text .......................................................................................................970 Getting Individual Words ........................................................................................................973 Fixed Documents .......................................................................................................................974 xxii ■ CONTENTS Annotations ................................................................................................................................976 The Annotation Classes ..........................................................................................................977 Enabling the Annotation Service .............................................................................................977 Creating Annotations ..............................................................................................................979 Examining Annotations ...........................................................................................................982 Reacting to Annotation Changes .............................................................................................986 Storing Annotations in a Fixed Document ...............................................................................986 Customizing the Appearance of Sticky Notes ..........................................................................987 The Last Word ............................................................................................................................988 ■Chapter 29: Printing .......................................................................................................................989 Basic Printing .............................................................................................................................989 Printing an Element ................................................................................................................990 Transforming Printed Output ..................................................................................................993 Printing Elements Without Showing Them ..............................................................................995 Printing a Document ..............................................................................................................996 Manipulating the Pages in a Document Printout ...................................................................1000 Custom Printing .......................................................................................................................1002 Printing with the Visual Layer Classes ..................................................................................1002 Custom Printing with Multiple Pages ....................................................................................1006 Print Settings and Management ...............................................................................................1012 Maintaining Print Settings ....................................................................................................1012 Printing Page Ranges ...........................................................................................................1012 Managing a Print Queue .......................................................................................................1013 Printing Through XPS ...............................................................................................................1016 Creating an XPS Document for a Print Preview .....................................................................1017 Writing to an In-Memory XPS Document ...............................................................................1018 Printing Directly to the Printer via XPS ..................................................................................1019 Asynchronous Printing .........................................................................................................1019 The Last Word ..........................................................................................................................1020 ¡Chapter 30: Interacting with Windows Forms ..............................................................................1019 Assessing Interoperability .........................................................................................................1019 Missing Features in WPF ......................................................................................................1020 XXIII ■ CONTENTS Mixing Windows and Forms .....................................................................................................1022 Adding Forms to a WPF Application ......................................................................................1022 Adding WPF Windows to a Windows Forms Application ........................................................1023 Showing Modal Windows and Forms ....................................................................................1023 Showing Modeless Windows and Forms ...............................................................................1024 Visual Styles for Windows Forms Controls ............................................................................1024 Windows Forms Classes That Don t Need Interoperability .....................................................1025 Creating Windows with Mixed Content .....................................................................................1029 WPF and Windows Forms Airspace ...................................................................................1030 Hosting Windows Forms Controls in WPF .............................................................................1031 WPF and Windows Forms User Controls ...............................................................................1034 Hosting WPF Controls in Windows Forms .............................................................................1035 Access Keys, Mnemonics, and Focus ...................................................................................1037 Property Mapping .................................................................................................................1039 The Last Word ..........................................................................................................................1041 ■Chapter 31 ¡Multithreading ..........................................................................................................1041 Multithreading ..........................................................................................................................1041 The Dispatcher .....................................................................................................................1042 The DispatcherObject ...........................................................................................................1042 The BackgroundWorker ........................................................................................................1045 The Last Word ..........................................................................................................................1054 ¡Chapter 32: The Add-in Model .....................................................................................................1055 Choosing Between MAF and MEF .............................................................................................1055 The Add-in Pipeline ..................................................................................................................1056 How the Pipeline Works .......................................................................................................1057 The Add-in Folder Structure .................................................................................................1059 Preparing a Solution That Uses the Add-in Model .................................................................1060 An Application That Uses Add-lns .............................................................................................1063 The Contract ........................................................................................................................1063 The Add-in View ...................................................................................................................1064 The Add-In ...........................................................................................................................1064 The Add-in Adapter ..............................................................................................................1065 XXIV ■ CONTENTS The Host View ......................................................................................................................1066 The Host Adapter .................................................................................................................1067 The Host ..............................................................................................................................1067 Adding More Add-lns ...........................................................................................................1070 Interacting with the Host ..........................................................................................................1071 Visual Add-lns ..........................................................................................................................1076 The Last Word ..........................................................................................................................1079 ■Chapter 33: ClickOnce Deployment .............................................................................................1079 Understanding Application Deployment ....................................................................................1080 The ClickOnce Installation Model ..........................................................................................1081 ClickOnce Limitations ...........................................................................................................1082 A Simple ClickOnce Publication ................................................................................................1083 Setting the Publisher and Production ....................................................................................1083 Starting the Publish Wizard ..................................................................................................1085 The Deployed File Structure .................................................................................................1091 Installing a ClickOnce Application .........................................................................................1092 Updating a ClickOnce Application .........................................................................................1093 Additional ClickOnce Options ....................................................................................................1094 Publish Version ....................................................................................................................1094 Updates ...............................................................................................................................1095 File Associations ..................................................................................................................1096 Publish Options ....................................................................................................................1098 The Last Word ..........................................................................................................................1099 xxv
any_adam_object 1
author MacDonald, Matthew
author_GND (DE-588)12398209X
author_facet MacDonald, Matthew
author_role aut
author_sort MacDonald, Matthew
author_variant m m mm
building Verbundindex
bvnumber BV036435792
classification_rvk ST 250
ctrlnum (OCoLC)699719013
(DE-599)GBV61671338X
discipline Informatik
format Book
fullrecord <?xml version="1.0" encoding="UTF-8"?><collection xmlns="http://www.loc.gov/MARC21/slim"><record><leader>01684nam a2200397 c 4500</leader><controlfield tag="001">BV036435792</controlfield><controlfield tag="003">DE-604</controlfield><controlfield tag="005">20121101 </controlfield><controlfield tag="007">t|</controlfield><controlfield tag="008">100504s2010 xx a||| |||| 00||| eng d</controlfield><datafield tag="020" ind1=" " ind2=" "><subfield code="a">9781430272052</subfield><subfield code="c">pbk</subfield><subfield code="9">978-1-4302-7205-2</subfield></datafield><datafield tag="035" ind1=" " ind2=" "><subfield code="a">(OCoLC)699719013</subfield></datafield><datafield tag="035" ind1=" " ind2=" "><subfield code="a">(DE-599)GBV61671338X</subfield></datafield><datafield tag="040" ind1=" " ind2=" "><subfield code="a">DE-604</subfield><subfield code="b">ger</subfield></datafield><datafield tag="041" ind1="0" ind2=" "><subfield code="a">eng</subfield></datafield><datafield tag="049" ind1=" " ind2=" "><subfield code="a">DE-706</subfield><subfield code="a">DE-523</subfield></datafield><datafield tag="084" ind1=" " ind2=" "><subfield code="a">ST 250</subfield><subfield code="0">(DE-625)143626:</subfield><subfield code="2">rvk</subfield></datafield><datafield tag="100" ind1="1" ind2=" "><subfield code="a">MacDonald, Matthew</subfield><subfield code="e">Verfasser</subfield><subfield code="0">(DE-588)12398209X</subfield><subfield code="4">aut</subfield></datafield><datafield tag="245" ind1="1" ind2="0"><subfield code="a">Pro WPF in C# 2010</subfield><subfield code="b">Windows presentation foundation in .NET 4</subfield><subfield code="c">Matthew MacDonald</subfield></datafield><datafield tag="264" ind1=" " ind2="1"><subfield code="a">[Berkeley, Calif.]</subfield><subfield code="b">Apress</subfield><subfield code="c">2010</subfield></datafield><datafield tag="300" ind1=" " ind2=" "><subfield code="a">XXXIII, 1181 S.</subfield><subfield code="b">Ill.</subfield></datafield><datafield tag="336" ind1=" " ind2=" "><subfield code="b">txt</subfield><subfield code="2">rdacontent</subfield></datafield><datafield tag="337" ind1=" " ind2=" "><subfield code="b">n</subfield><subfield code="2">rdamedia</subfield></datafield><datafield tag="338" ind1=" " ind2=" "><subfield code="b">nc</subfield><subfield code="2">rdacarrier</subfield></datafield><datafield tag="490" ind1="0" ind2=" "><subfield code="a">The expert's voice in .NET</subfield></datafield><datafield tag="650" ind1="0" ind2="7"><subfield code="a">Microsoft dot net 4.0</subfield><subfield code="0">(DE-588)7701686-5</subfield><subfield code="2">gnd</subfield><subfield code="9">rswk-swf</subfield></datafield><datafield tag="650" ind1="0" ind2="7"><subfield code="a">Windows Presentation Foundation</subfield><subfield code="0">(DE-588)7551149-6</subfield><subfield code="2">gnd</subfield><subfield code="9">rswk-swf</subfield></datafield><datafield tag="650" ind1="0" ind2="7"><subfield code="a">C sharp</subfield><subfield code="0">(DE-588)4616843-6</subfield><subfield code="2">gnd</subfield><subfield code="9">rswk-swf</subfield></datafield><datafield tag="689" ind1="0" ind2="0"><subfield code="a">Windows Presentation Foundation</subfield><subfield code="0">(DE-588)7551149-6</subfield><subfield code="D">s</subfield></datafield><datafield tag="689" ind1="0" ind2="1"><subfield code="a">C sharp</subfield><subfield code="0">(DE-588)4616843-6</subfield><subfield code="D">s</subfield></datafield><datafield tag="689" ind1="0" ind2="2"><subfield code="a">Microsoft dot net 4.0</subfield><subfield code="0">(DE-588)7701686-5</subfield><subfield code="D">s</subfield></datafield><datafield tag="689" ind1="0" ind2=" "><subfield code="8">1\p</subfield><subfield code="5">DE-604</subfield></datafield><datafield tag="776" ind1="0" ind2="8"><subfield code="i">Erscheint auch als</subfield><subfield code="n">Online-Ausgabe</subfield><subfield code="z">978-1-4302-7204-5</subfield></datafield><datafield tag="856" ind1="4" ind2="2"><subfield code="m">Digitalisierung UB Bamberg</subfield><subfield code="q">application/pdf</subfield><subfield code="u">http://bvbr.bib-bvb.de:8991/F?func=service&amp;doc_library=BVB01&amp;local_base=BVB01&amp;doc_number=020308261&amp;sequence=000002&amp;line_number=0001&amp;func_code=DB_RECORDS&amp;service_type=MEDIA</subfield><subfield code="3">Inhaltsverzeichnis</subfield></datafield><datafield tag="883" ind1="1" ind2=" "><subfield code="8">1\p</subfield><subfield code="a">cgwrk</subfield><subfield code="d">20201028</subfield><subfield code="q">DE-101</subfield><subfield code="u">https://d-nb.info/provenance/plan#cgwrk</subfield></datafield><datafield tag="943" ind1="1" ind2=" "><subfield code="a">oai:aleph.bib-bvb.de:BVB01-020308261</subfield></datafield></record></collection>
id DE-604.BV036435792
illustrated Illustrated
indexdate 2024-12-23T23:57:52Z
institution BVB
isbn 9781430272052
language English
oai_aleph_id oai:aleph.bib-bvb.de:BVB01-020308261
oclc_num 699719013
open_access_boolean
owner DE-706
DE-523
owner_facet DE-706
DE-523
physical XXXIII, 1181 S. Ill.
publishDate 2010
publishDateSearch 2010
publishDateSort 2010
publisher Apress
record_format marc
series2 The expert's voice in .NET
spellingShingle MacDonald, Matthew
Pro WPF in C# 2010 Windows presentation foundation in .NET 4
Microsoft dot net 4.0 (DE-588)7701686-5 gnd
Windows Presentation Foundation (DE-588)7551149-6 gnd
C sharp (DE-588)4616843-6 gnd
subject_GND (DE-588)7701686-5
(DE-588)7551149-6
(DE-588)4616843-6
title Pro WPF in C# 2010 Windows presentation foundation in .NET 4
title_auth Pro WPF in C# 2010 Windows presentation foundation in .NET 4
title_exact_search Pro WPF in C# 2010 Windows presentation foundation in .NET 4
title_full Pro WPF in C# 2010 Windows presentation foundation in .NET 4 Matthew MacDonald
title_fullStr Pro WPF in C# 2010 Windows presentation foundation in .NET 4 Matthew MacDonald
title_full_unstemmed Pro WPF in C# 2010 Windows presentation foundation in .NET 4 Matthew MacDonald
title_short Pro WPF in C# 2010
title_sort pro wpf in c 2010 windows presentation foundation in net 4
title_sub Windows presentation foundation in .NET 4
topic Microsoft dot net 4.0 (DE-588)7701686-5 gnd
Windows Presentation Foundation (DE-588)7551149-6 gnd
C sharp (DE-588)4616843-6 gnd
topic_facet Microsoft dot net 4.0
Windows Presentation Foundation
C sharp
url http://bvbr.bib-bvb.de:8991/F?func=service&doc_library=BVB01&local_base=BVB01&doc_number=020308261&sequence=000002&line_number=0001&func_code=DB_RECORDS&service_type=MEDIA
work_keys_str_mv AT macdonaldmatthew prowpfinc2010windowspresentationfoundationinnet4