Having a solid grasp of the class
hierarchy of any library that you regularly use helps to improve your
productivity and provides a good starting point to gaining a deeper
understanding of how a framework is designed to work. It gives you a
shortcut for determining what can and cannot be done with a particular
type based on its inherited members and whether commonly named members
from two different classes are from a shared superclass or have nothing
to do with one another. In essence it allows you to better assess what
you can achieve using the building blocks and how to avoid making poor
design decisions. On that note, this section begins with an overview of
the Windows Phone control class hierarchy.
The title of this part of the book is “Essential Elements,” and we begin with the class FrameworkElement
. The FrameworkElement
provides a set of common APIs for objects that participate in XAML-based layout. FrameworkElement
also defines members related to data binding, the visual tree, and
object lifetime feature areas. It is also the superclass for most of
the types presented in this part of the book (see Figure 1).
FIGURE 1 Top-level elements of the Windows Phone FCL for XAML apps.
FIGURE 2 Control types within the FCL.
Identifying Controls Not Supported or Absent in Windows Phone
Some controls that are present in the Windows
Phone SDK are not shown in the Visual Studio Toolbox or are not
recommended for use due to platform differences or design constraints.
These platform differences are mostly related to the phone’s touch
driven UI and reduced display size.
In addition, the following Silverlight controls do not exist in the Windows Phone FCL:
- DataGrid
- DatePicker
(present in the Windows Phone Toolkit)
- OpenFileDialog
- SaveFileDialog
- Label
- GridSplitter
- TabControl
- TreeView
Some controls exist but are not supported. The following controls should not be used directly:
- Calendar
- Frame—Use the PhoneApplicationFrame instead.
- Page—Use the PhoneApplicationPage instead.
- ScrollBar—Used by the ScrollViewer.