Charles Petzold



A Few Facts About My Book

September 28, 2006
New York, NY

Just so there's no confusion, here are a few facts about my recent book Applications = Code + Markup: A Guide to the Microsoft Windows Presentation Foundation:

  1. The book is a tutorial. The chapters are designed to be read sequentially. That's why they're numbered. All my programming books have been tutorials. (Over the years many people have come up to me and bragged that they read the first, second, or third edition of Programming Windows from beginning to end.) If you use Programming Windows as a reference, it is because you're familiar enough with the API and the book to do so. I myself use my WPF book as a reference. I hope someday you will as well.
  2. The book has no screen-shots. I struggled with this issue. I didn't want to do the screen-shots under XP (the "luna" look) because if lots of people migrate to Vista the book will look old-fashioned very quickly. But I was hesitant about doing Vista screen-shots (the "aero" look) because I didn't want people to presume that WPF was a Vista-only API. I considered having side-by-side XP and Vista screen-shots. And then I thought: Ya know, it's not about the screen-shots. It's about the code. So, I didn't do screen-shots. I understand that some people use screen-shots to navigate their way through a book like this, and I apologize that I was not more sensitive to this need.
  3. The chapters have no sub-headings. Many of the chapters are rather short, and I anticipated that readers learning WPF might tackle one chapter per day. I wrote the chapters to be read continuously from beginning to end, so sub-headings just seemed superfluous. (I'm not a big fan of books that have so many headings and sub-headings they start looking like PowerPoint slides.) Again, I understand that some people use sub-headings for navigation, and I apologize.
  4. The book definitely shows how to write custom controls. Somebody said the book has no custom controls. In WPF, what constitutes a custom control is a little amorphous. The book has tons of classes that derive from WPF controls. Chapter 10 is entitled "Custom Elements." (Elements are a superset of controls.) I also have a chapter on Templates, which is a handy method for entirely redefining the visuals of a control. I also have several "from scratch" custom controls. Chapter 11 has a RoundedButton control that shows low-level keyboard and mouse handling, and a ColorGrid control similar to that found in the MS Word. Chapter 25 has a DatePicker control and a Chapter 26 has a NavigationBar similar to the WinForms 2.0 BindingNavigator. Nor are custom common dialog boxes ignored. Chapter 17 has a FontDialog.
  5. The RadialPanel is not an original idea. In Chapter 12 I have a RadialPanel element that displays its children in a circle. This panel was inspired by a demo program by Henry Hahn, who is one of the WPF guys at Microsoft who is thanked in the Introduction of the book. I looked at Henry's code to get a sense of how such a thing is done. But I couldn't quite understand his code, and I was a little disturbed by a variable named _fudgeFactor. So, I entirely re-thought the problem. Chapter 12 contains some essential diagrams for working out the geometry and trigonometry for efficiently fitting rectangular controls within pie wedges. If you ever need to write a radial-panel a little different from mine, you will benefit greatly by studying these diagrams and the resultant code. If my RadialPanel is fine for your use, then great! Use it, and rest assured it doesn't contain a variable named _fudgeFactor.
  6. The code samples are installed by a setup.exe using the Microsoft Installer. Someone said that installing the samples requires Administrator privileges. I just tried it as a Limited user and it ran fine. At any rate, this installation is actually not part of the author's responsibility, so I must plead innocence. I give the final code samples to Microsoft Press in a ZIP file and they put it into the installation program. If you have problems with this installation program, it might be a good topic for an email to Microsoft press at mspinput@microsoft.com.
  7. The book has a whole chapter on Dependency Properties. If you think you know what .NET properties are all about, wait until you see these things! It's not a sexy topic, but it's of vital importance to WPF, and that's why Chapter 8 is devoted to Dependency Properties. I hope all WPF books have a chapter on Dependency Properties because I'm curious how other authors approached this topic.
  8. The book has a whole chapter on Routed Events. Again, you may think you know about .NET events, but this stuff is new. Chapter 9 is devoted to this unsexy but vital topic. I hope all WPF books have a chapter devoted to Routed Events.
  9. Two chapters of the book are obsessed with MeasureOverride and ArrangeOverride. These are Chapters 11 and 12. If you need to know what's going on in these methods, check out these chapters. I spent a lot of time exploring these methods, and I wrote down everything I discovered.
  10. The book is damn cheap. If you wanted to hire me at minimum wage ($5.15 an hour) for 40 hours a week for 40 weeks, it would cost you $8,240. The book gets you that same amount of my work for less than $60, conveniently written down and bound for your convenience.