Within the Windows Phone Framework Class Library (FCL), there are some types, which, on first appearance, you could be forgiven for thinking that API similarities are the result of common ancestry. The TextBlock
and TextBox
elements, for example, have numerous similarly named text and font related properties, yet both have their own distinct API and their closest ancestor is FrameworkElement
(see Figure 6.1).
The TextBox
and PasswordBox
are derived from the System.Windows.Control
class. The Control
class is the base class for UI elements that use a ControlTemplate
to define their appearance. And while the TextBlock
lives in the System.Controls
namespace, it is not a Control
, making it impossible to drastically change its appearance. Those familiar with WPF will know that WPF has the Label
class, which is derived from Control
and which fills this gap. There is, however, no such control in the Windows Phone SDK.
The similarities between the TextBlock
and TextBox
APIs do mean, however, that the elements can be styled in much the same manner; the characteristics of most font and layout related properties apply equally to all three text elements.
18.116.21.232