The Book's Gotta Have It
January 16, 2005
A feels-like-3° NYC
892 pages into the popular text The Art of Electronics, 2nd edition, by Paul Horowitz and Winfield Hill, the authors finally get around to discussing a certain topic. A paragraph begins:
-
Since radiofrequency techniques find their greatest application in communications, it is important to understand how signals can be modulated and demodulated, i.e., how radiofrequencies are used to carry information from one place to another.
And then the paragraph concludes:
-
Besides, how would you feel if, after taking a course in electronics, someone asked you how a radio works and you didn't know?
I often think about that passage when working on a book, and particularly last week, when I retitled a "Custom Controls" chapter to "Custom Elements." The question reformulated in my mind is:
-
"How would you feel if, after reading a book on the WPF, someone asked you how to inherit from FrameworkElement and you didn't know?"
That means I got deep into MeasureOverride and ArrangeOverride. About 44 classes in the WPF override the first method, and about 39 classes the second method, so it's obvious to me that these methods are very important in understanding automatic sizing and layout. But they're not trivial. Although I have several sample classes that illustrate inheriting from FrameworkElement and Control — including a UniformGrid-like panel and a color-selection control like the one in MS Word — my attempts to reverse-engineer Measure and Arrange have yielded unsatisfactory results (so far).
"Custom Elements" is one of three "conceptual chapters" that appear in the middle of Part 1 of the book. The other two are "Dependency Properties" and "Routed Input Events," both of which are necessary preliminaries to inheriting from FrameworkElement.