We can now create windows and place elements in them. We have noticed that some elements, for example, StackPanel and Canvas, can act as containers for other elements. At this point, we need to consider how the element classes relate to each other. They are structured in the form of a class hierarchy. A child class can extend a parent class, using the abilities and properties of the parent while adding and overriding behavior, as it requires.
Figure 7-16 shows the hierarchy of some of the elements in the Windows Presentation Foundation implementation on the .NET Micro Framework. All display items descend from the class UIElement. This class provides a set of core behaviors and properties common to all display elements. As an example, all elements must have a Visibility property that controls whether the property is visible. They also need properties to control alignment in the display area provided by the container object. The properties HorizontalAlignment and VerticalAlignment are used to manage these for all elements.
Figure 7-16: Part of the display-element class hierarchy.