Wiley.com
Print this page Share

Professional WPF Programming: .NET Development with the Windows Presentation Foundation

ISBN: 978-0-470-04180-2
Paperback
480 pages
May 2007
Professional WPF Programming: .NET Development with the Windows Presentation Foundation (0470041803) cover image
This title is out-of-print and not currently available for purchase from this site.

Acknowledgments ix

Introduction xix

Chapter 1: Overview of Windows Presentation Foundation 1

A Brief History of the Windows API 2

Platform Evolution 2

Introducing .NET Framework 3.0 3

Meet Windows Presentation Foundation 3

Guiding Design Principles 3

Architecture 5

XAML 15

Declarative vs. Imperative 15

Visual Design Tools 18

XamlPad 18

Microsoft Expression Blend 19

Visual Designer for Windows Presentation Foundation 20

Electric Rain ZAM 3D 21

Mobiform Aurora 22

Summary 23

Chapter 2: WPF and .NET Programming 25

Getting Started 26

Required Installations 26

Types of WPF Applications 26

My First WPF Application 27

WPF Development Concepts 29

XAML 29

The Application Object 30

Creating the User Interface 32

Handling Events 35

Working with Controls 41

Triggers 51

Language Support 58

Deployment 61

Summary 61

Chapter 3: Anatomy of a WPF-Enabled Application 63

Project Composition 63

App.Manifest 66

AssemblyInfo.cs 66

Resources.resx 68

Settings.settings 68

MyApp.xaml 70

.NET Framework 3.0 Windows Application 71

Window1.xaml 72

XAML Browser Application 73

Page1.xaml 73

WCF Service Library 75

Class1.cs 75

WPF Custom Control Library 78

UserControl1.xaml 79

Summary 82

Chapter 4: Building a Rich UI with Microsoft Expression Blend — Part I 83

Overview 84

The Design Environment 85

Workspace Panels 86

The Artboard 87

Configuring the Environment 88

Project Structure 90

Adding a New Project File 90

Building and Deploying a Project 91

Creating Vector Objects 91

Shapes 92

Paths 93

Manipulating Objects with the Properties Panel 94

The Transform Panel 94

The Brushes Panel 95

Opacity, Transparency, and Visibility 97

Manipulating Text 98

Managing Layouts 99

UI Layout Panels 100

Other Layout Controls 103

Nesting Layout Panels 103

Animation 104

Timeline Sub-Panel 104

Keyframes 105

Animate an Object’s Property 106

Motion Paths 106

Triggers 107

Creating Controls 108

Templates 110

Styles 111

States 112

Importing Audio/Video Media 113

Summary 113

Chapter 5: Building a Rich UI with Microsoft Expression Blend — Part II 115

Expression Blend Workflow 116

Code Editing with Visual Studio 2005 117

Handling User Input 118

Keyboard and Mouse Classes 118

Events and Event Handling 118

Positioning 120

Hit Testing 124

The WPF Animation API 135

Animation Classes 135

Creating a Dynamic Animation Procedurally with Code 135

Programmatic Animation 139

Interacting with Storyboards 143

WPF Drawing API 145

Geometry 145

Shapes 146

Brushes 149

Summary 153

Chapter 6: Special Effects 155

Brushes 156

SolidColorBrush 156

GradientBrush 162

ImageBrush 165

DrawingBrush 167

VisualBrush 169

Bitmap Effects 171

Transformations 175

TranslateTransform 178

ScaleTransform 180

SkewTransform 183

RotateTransform 186

Opacity Masks 188

Putting It All Together — Combining Effects 191

Bouncing Ball with Reflection Example 191

Animated Image Viewer Example 197

Summary 203

Chapter 7: Custom Controls 205

Overview 206

Control Base Classes 207

The UserControl Class 207

Creating a User Control 207

Data Binding in WPF 217

Binding Markup Extensions 217

Binding Modes 217

Data Templates 219

Data Conversions 221

Creating and Editing Styles 222

Specifying a Style’s Target Type 223

Inheriting and Overriding Styles 224

Style Triggers 226

Customizing Existing Controls with Templates 228

Summary 231

Chapter 8: Using WPF in the Enterprise 233

WPF Application Models 234

Standalone Applications 235

Browser-Based Applications 238

Security Considerations 247

State Management 248

Application Object 248

Isolated Storage 250

State Management Example 252

Navigation 258

Elements of Navigation 258

Structured Navigation 259

Navigation Topologies 269

Application Localization 286

Automatic Layout Guidelines 287

Using Grids for Flexibility 289

Localization Attributes and Comments 290

WPF Deployment Models 291

Building Applications 292

Deploying Standalone Windows Applications 294

Deploying XAML Browser Applications 295

Deploying the .NET Framework 3.0 Runtime 296

Summary 298

Chapter 9: Security 299

WPF Security Model 299

Trusted Versus Express Applications 300

Core OS Security 300

LUA 301

Virtualization 301

Sandboxing 301

Cryptography Next Generation 302

CLR Security 302

Code Access Security 303

The Critical Code Methodology 311

Verification 313

Microsoft Internet Explorer Security 313

Zone Restrictions 313

XBAP Sandbox Workarounds 314

XAML Browser Application Security 315

ClickOnce Security 323

Trusted Publishers 323

Personal Certificate File 324

.NET 3.0 Security Utilities 327

Summary 328

Chapter 10: WPF and Win32 Interop 329

Win32 User Interface Overview 330

How WPF and HWNDs Interoperate 330

Using Win32 HWNDs Inside of WPF 331

Hosting a Win32 Button in WPF 332

Using WPF in Win32 Applications 335

Adding Windows Forms Controls to WPF 337

Adding Your WindowsFormsHost in Code 337

Adding Your HwndHost in XAML 339

Adding ActiveX Controls to WPF 339

Adding the ActiveX Control in XAML 344

Adding WPF Controls to Windows Forms 345

Affecting Control Properties 349

Summary 351

Chapter 11: Advanced Development Concepts 353

WPF Architecture 354

Core Subsystems 356

WPF Threading Model 359

Desktop Window Manager 360

The WPF Framework 361

Dispatcher Object 362

DependencyObject/DependencyProperty 362

Application 363

Freezable 364

Visual 364

UIElement 370

FrameworkElement 371

Control 371

A Deeper Look at XAML 373

XAML Under the Hood 373

Manipulating XAML On-the-Fly 378

Deconstructing Window1.xaml 382

x:Class 383

XAML Markup Extensions 385

XAML and Custom Types 386

WPF Multithreading 388

Single-Threaded Application Model 388

Thread Affinity and DispatcherObject 389

WPF Dispatcher 390

Working with Single-Threaded Applications 391

Asynchronous Threading 393

Windows Communication Foundation 397

Service Orientation 397

WCF Architecture 398

WCF Fundamentals 399

Building a WCF Service 402

Windows Workflow Foundation 409

Workflow Defined 410

WF Architecture 411

WF Fundamentals 411

Summary 427

Index 429

Back to Top